Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 514 Bytes

serverless-publicRuntimeConfig.md

File metadata and controls

23 lines (17 loc) · 514 Bytes

Using publicRuntimeConfig or serverRuntimeConfig with target set to serverless

Why This Error Occurred

In the serverless target environment next.config.js is not loaded, so we don't support publicRuntimeConfig or serverRuntimeConfig.

Possible Ways to Fix It

Use config option env to set build time variables like such:

// next.config.js
module.exports = {
  env: {
    special: 'value',
  },
}
// pages/index.js
console.log(process.env.special) // value