question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling `Sentry.init()` with empty dsn doesn't throw error

See original GitHub issue

Versions + Platform

  • SDK version - @sentry/electron@v^2.5.0
  • Electron version - electron@v9.4.4
  • Platform - macOS`

Description

If I call Sentry.init({ dsn: "" }) then no error is thrown but instead the follow log line is logged to console.error: SentryError: Attempted to enable Electron native crash reporter but no DSN was supplied.

This is because of the forget call at https://github.com/getsentry/sentry-electron/blob/edd2775048d4658f88fd23a989574da913e6762a/src/main/backend.ts#L101

That function really shouldn’t be async at all since it includes 0 await’s and two forget’s itself.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
timfishcommented, Jul 13, 2021

You can validate a DSN something like this:

import { DSN } from '@sentry/utils';

const dsnString = 'some-dsn@sentry.io';
try {
  const dsn = new DSN(dsnString);
} catch (_) {
  // DSN was invalid
}
0reactions
Nokel81commented, Jul 13, 2021

If you set it to a invalid sdn then I believe it does throw. Would you be willing to expose a validation function then?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No way to tell when Sentry.init() is complete #1612 - GitHub
Reading the docs, and some of the code, I cant see a way to tell when Sentry.init() is complete. This is making it...
Read more >
Troubleshooting for JavaScript - Sentry Documentation
If you're seeing errors with the message “Non-Error exception (or promise rejection) captured with keys: x, y, z.”, this happens when you a)...
Read more >
PHP SDK not sending errors to Sentry when invoked from IBM ...
In OpenWhisk we never shut down as we run in a never-ending loop until the Docker container is killed. Update: You can now...
Read more >
getsentry/dotnet - Gitter
Setting it to "" doesn't work. I can try string.Empty ... Installed Sentry v1.1.2, and called the Sentry init() function (with the appropriate...
Read more >
Integrated error tracking compatibility with Sentry SDK - GitLab
The Python SDK sends the payload with GZIP compression. This can be identified through the Content-Encoding: gzip header. However, GitLab does not appear...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found