Skip to content

Latest commit

 

History

History
119 lines (89 loc) · 1.63 KB

invalid-page-config.md

File metadata and controls

119 lines (89 loc) · 1.63 KB

Invalid Page / API Route Config

Why This Error Occurred

In one of your pages or API Routes you did export const config with an invalid value.

Possible Ways to Fix It

The page's config must be an object initialized directly when being exported and not modified dynamically. The config object must only contains static constant literals without expressions.

Not Allowed Allowed
// `config` should be an object
export const config = 'hello world'
export const config = {}
export const config = {}
// `config.amp` is defined after `config` is exported
config.amp = true

// `config.amp` contains a dynamic expression
export const config = {
  amp: 1 + 1 > 2,
}
export const config = {
  amp: true,
}

export const config = {
  amp: false,
}
// `config.runtime` contains a dynamic expression
export const config = {
  runtime: `node${'js'}`,
}
export const config = {
  runtime: 'nodejs',
}
export const config = {
  runtime: `nodejs`,
}
// Re-exported `config` is not allowed
export { config } from '../config'
export const config = {}

Useful Links