Skip to content

publicRuntimeConfig is empty during development #8338

@ghost

Description

Bug report

Using Next.js v9.0.3

Describe the bug

During development, the public runtime config is empty, even though publicRuntimeConfig is set in the config file.
image

However, the config is available when the project is built and running on production.

To Reproduce

  1. Add publicRuntimeConfig in the next.config.js file.
// for example
publicRuntimeConfig: {
 API_URL: 'http://localhost:3001/api'
}
  1. Open browser console and window.__NEXT_DATA__.runtimeConfig as shown in the image above.
  2. It will return empty object {}, even though public runtime config should have API_URL value.

Expected behavior

publicRuntimeConfig should be available both in development and production.

System information

  • Version of Next.js: 9.0.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions