Sentry-javascript: Invalid DSN

Created on 20 Mar 2018  路  3Comments  路  Source: getsentry/sentry-javascript

I was trying to connect sentry to my express app using raven and it says my DSN is invalid. I tried both the regular one and the public DSN. But none worked. any idea why?

Needs Information

Most helpful comment

Just found the issue! In the .env file we can't add double quotes! So the following...

RAVEN_DSN="https://********************:********************@sentry.io/******"

should be written as:

RAVEN_DSN=https://********************:********************@sentry.io/******

All 3 comments

It's hard to help without any code/config/version info that I could use to debug the issue :)

You may mask part of your DSN with ********* if you need to.

Really sorry about that. Here's how I configured the app:

// Configure error reporting
if (process.env.RAVEN_DSN) {
  Raven.config(process.env.RAVEN_DSN).install();
  app.use(Raven.requestHandler());
}

And at the end I placed

app.use(Raven.errorHandler());

In the .env file:

RAVEN_DSN="https://********************:********************@sentry.io/******"

I did a console log of process.env.RAVEN_DSN and it's being loaded correctly and the error message reads like this:

Error: Invalid Sentry DSN: "https://********************:********************@sentry.io/******"
    at Object.parseDSN (/usr/src/app/node_modules/raven/lib/utils.js:193:11)
    at Raven.config (/usr/src/app/node_modules/raven/lib/client.js:52:22)
    at Object.<anonymous> (/usr/src/app/dist/app.js:65:19)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

Just found the issue! In the .env file we can't add double quotes! So the following...

RAVEN_DSN="https://********************:********************@sentry.io/******"

should be written as:

RAVEN_DSN=https://********************:********************@sentry.io/******
Was this page helpful?
0 / 5 - 0 ratings