Skip to content

next.config.js ajv verification: analyticsId - must NOT have additional properties #38909

@bonesoul

Description

@bonesoul

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 18.4.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 12.2.3
      eslint-config-next: 12.2.3
      react: 18.2.0
      react-dom: 18.2.0

What browser are you using? (if relevant)

chrome

How are you deploying your application? (if relevant)

next start

Describe the Bug

seems next 12.2.3 do now validates next.config.js with ajv (#38498).

As I'm using vercel analytics on my non-vercel deployments, I need to hand in the analyticsId property to next.config.js.

/**
 * @type {import('next').NextConfig}
 **/
const config = {
  trailingSlash: false, // disable trailing slashes.
  poweredByHeader: false, // disable powered by header.
  reactStrictMode: true, // set strict mode for react.
  swcMinify: true, // minify using swc/rust.
  compress: false, // let nginx handle compression.
  analyticsId: "MY_ANALYTICS_ID", // vercel analytics id.

and at the very startup next 12.2.3 now warns about the analyticsId property:

warn  - Invalid next.config.js options detected:
[
  {
    "instancePath": "",
    "schemaPath": "#/additionalProperties",
    "keyword": "additionalProperties",
    "params": {
      "additionalProperty": "analyticsId"
    },
    "message": "must NOT have additional properties"
  }
]
See more info here: https://nextjs.org/docs/messages/invalid-next-config

Expected Behavior

allow analyticsId property without a warning.

Link to reproduction

.

To Reproduce

add analyticsId from vercel to next.config.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions