Skip to content

@sentry/nextjs not working on server #3691

@cyrus-za

Description

@cyrus-za

Package + Version

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

Version:

6.7.1

Description

When I scafold a nextjs app (using nx workspaces, but probably unrelated) and add sentry to it, the frontend works just fine, but running next dev results in pages/api/* routes not logging to sentry. I do use the withSentry wrapper around my handlers, but it appears that Sentry.init never gets called despite sentry.server.config.js being configured. Calling it manually right outside the handler fixes it, so it's definitely got to do with the cli not calling init. I am guessing the init gets called during webpack builds which is configured to only run in production (I dont want to upload source maps for local dev).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions