Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error message received when Sentry DSN not provided #12040

Closed
3 tasks done
whitep4nth3r opened this issue May 15, 2024 · 1 comment · Fixed by #12041
Closed
3 tasks done

Incorrect error message received when Sentry DSN not provided #12040

whitep4nth3r opened this issue May 15, 2024 · 1 comment · Fixed by #12041
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug

Comments

@whitep4nth3r
Copy link

whitep4nth3r commented May 15, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.0.0

Framework Version

Express 4.17.17

Link to Sentry event

No response

SDK Setup

Sentry.init({
  enabled: true,
  dsn: process.env.NODE_ENV === "production" ? process.env.SENTRY_DSN : "",
  debug: process.env.NODE_ENV !== "production" ? true : false,
  release: process.env.npm_package_version,
  environment: process.env.NODE_ENV,
  sampleRate: 0.5,
  maxBreadcrumbs: 100,
  sendClientReports: true,
  integrations: [nodeProfilingIntegration()],
  tracesSampleRate: 0.5,
  profilesSampleRate: 0.5,
});

Steps to Reproduce

  1. Run dev environment where DSN is not provided (in order to not spam Sentry with bugs in dev)
  2. Observe message in console: [Sentry] Express is not instrumented. This is likely because you required/imported express before calling Sentry.init().
  3. I have confirmed I am importing files in the correct order and using Sentry.setupExpressErrorHandler(app);.
  4. When providing a DSN in dev, the "not instrumented" message is not sent, and Sentry works and logs events as expected.

Expected Result

I should only see:
Sentry Logger [warn]: No DSN provided, client will not send events.
message in the console, and not the:
[Sentry] Express is not instrumented. This is likely because you required/imported express before calling Sentry.init().
message, if my app is set up correctly.

Actual Result

image
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label May 15, 2024
@mydea
Copy link
Member

mydea commented May 15, 2024

Ah, I guess we should not show this if the SDK is not enabled - will adjust this, thanks for raising!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants