Skip to content

@sentry/nextjs - sentry.client.config.js doesn't have access to runtime config #3485

@sophiekoonin

Description

@sophiekoonin

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other: @sentry/nextjs

Version:

6.3.4

Description

I've just set up @sentry/nextjs on our Next app, but I'm having an issue with the client side implementation as it seems sentry.client.config.js doesn't have access to runtime config. It looks like getConfig() from next/config is undefined when Sentry initialises on the client.

We need to use publicRuntimeConfig because our app is built once but deployed across multiple environments, so we don't have the environment name at build time.

Minimal reproduction: CodeSandbox
(NB. I set the withSentryConfig option silent: false to prevent my auth token being logged to console, even though it's just a test organisation!). Note the page is blank, and looking in the dev tools console (not the codesandbox console, the actual browser one) shows the error in question.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions