next.config.js ajv verification: analyticsId - must NOT have additional properties
See original GitHub issueVerify 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 (https://github.com/vercel/next.js/pull/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.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
next.config.js must NOT have additional properties
It finally seems that Next.js just wanted an update and a small refactor in next.config.js.. So, now it looks like this without any...
Read more >Ajv options - Ajv JSON schema validator
This page describes properties of the options object that can be passed to Ajv ... It does not change any validation results, but...
Read more >the request of a dependency is an expression nextjs - You.com
1- warn - Invalid next.config.js options detected: The root value has an unexpected property, webpack5, which is not in the list of allowed...
Read more >Validating JSON with ajv - YouTube
Validating JSON with ajv in node. js and browser projects. Another json validator is a very good library todo so. It allows you...
Read more >JSON-Schema everywhere. How to make web development ...
The data can contain the other properties defined under the ... We will use a very popular JSON-Schema-Validation library named AJV which is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Getting this same error when using
next-pwa
! In this case, the additionalProprty it doesn’t like is"pwa"
Same issue here when using NX and exportPathMap: