Skip to content

Conversation

@lforst
Copy link
Contributor

@lforst lforst commented May 3, 2024

#11823 rightfully mentioned that the way we recommend people to init the SDK may crash if there are nodejs specific packages being imported in instrumentation.ts.

We could solve this by either changing the way we recommend users to add configuration like so:

import * as Sentry from '@sentry/nextjs';

export async function register() {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    await import('./sentry.server.config.ts');
  }

  if (process.env.NEXT_RUNTIME === 'edge') {
    await import('./sentry.edge.config.ts');
  }
}

But for now I'd rather keep the base-case simple and add additional explanation for the more complicated case. Maybe we need to switch this up in the future.

@lforst lforst merged commit 85c754a into develop May 3, 2024
@lforst lforst deleted the lforst-clarify-node-specific-imports-in-nextjs-register branch May 3, 2024 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants