Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
bonesoul opened this issue Jul 22, 2022 · 10 comments · Fixed by #38911
Closed
1 task done

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

bonesoul opened this issue Jul 22, 2022 · 10 comments · Fixed by #38911
Labels
bug Issue was opened via the bug report template.

Comments

@bonesoul
Copy link

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.

@bonesoul bonesoul added the bug Issue was opened via the bug report template. label Jul 22, 2022
@tatwater
Copy link

Getting this same error when using next-pwa! In this case, the additionalProprty it doesn't like is "pwa"

@ijjk
Copy link
Member

ijjk commented Jul 22, 2022

Hi @tatwater, that is expected as next-pwa is passing an additional config value to Next.js which isn't a valid value so to remove this warning it would need to be corrected in that package.

@theoludwig
Copy link
Contributor

Related next-pwa issue: shadowwalker/next-pwa#367

@chrisleyva
Copy link

Hi @tatwater, that is expected as next-pwa is passing an additional config value to Next.js which isn't a valid value so to remove this warning it would need to be corrected in that package.

Hello @ijjk Looking at the Next docs for setting up the MDX plugin, is pageExtensions a valid config value? How would the plug-in work now with this new ajv verification feature?

Thank you.

@ijjk
Copy link
Member

ijjk commented Jul 27, 2022

@chrisleyva yes pageExtensions is a valid config as can be seen here

@amaralc
Copy link

amaralc commented Jul 29, 2022

Same issue here when using NX and exportPathMap:



warn  - Invalid next.config.js options detected:
--
[
  {
    "instancePath": "",
    "schemaPath": "#/additionalProperties",
    "keyword": "additionalProperties",
    "params": {
    "additionalProperty": "nx"
  },
  "message": "must NOT have additional properties"
  },
  {
    "instancePath": "",
    "schemaPath": "#/additionalProperties",
    "keyword": "additionalProperties",
    "params": {
      "additionalProperty": "exportPathMap"
    },
    "message": "must NOT have additional properties"
  }
]

@ijjk
Copy link
Member

ijjk commented Jul 29, 2022

The exportPathMap warning does look like a bug, PR opened here #39171 to address that

@hafizasadabbas
Copy link

hafizasadabbas commented Aug 4, 2022

Same issue when using i18n in next.config.js

warn - Invalid next.config.js options detected:
[
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "localePath"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "localeDir"
},
"message": "must NOT have additional properties"
}
]

@ijjk
Copy link
Member

ijjk commented Aug 4, 2022

@hafizasadabbas the warning above seems correct as those aren't valid i18n config fields.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants