Skip to content

Error parsing DSN (+ can't get error message without debugging) #331

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

Closed
slorber opened this issue Mar 13, 2015 · 6 comments
Closed

Error parsing DSN (+ can't get error message without debugging) #331

slorber opened this issue Mar 13, 2015 · 6 comments

Comments

@slorber
Copy link

slorber commented Mar 13, 2015

Hi,

I'm using Browserify and trying to bundle Raven into my appLibs.js bundle.
The browserify part seems to work fine (#197)

But I have a problem with errors being thrown during DSN parsing. I'm using exactly the same DSN that I used previously with non-browserify version. (using //cdn.ravenjs.com/1.1.15/jquery,native/raven.min.js)

So maybe it's a regression?

Notice that I have an error message with no msg at all:

Error
    at http://localhost:8080/appLibs.js:77951:30
    at Object.require.raven-js (http://localhost:8080/appLibs.js:78366:3)
    at s (http://localhost:8080/appLibs.js:1:262)
    at s (http://localhost:8080/app.js:1:142)
    at s (http://localhost:8080/app.js:1:122)
    at http://localhost:8080/app.js:1:313
    at Object.require.app.appConstants (http://localhost:8080/app.js:47956:13)
    at s (http://localhost:8080/app.js:1:262)
    at http://localhost:9000/:16171:30 

When opening the debugger I can see the source of the error being thrown is RavenConfigError.prototype = new Error();

By hacking the debugger I was able to finally get the error source during the parsing of the DSN: Cannot read property '6' of null

@slorber
Copy link
Author

slorber commented Mar 13, 2015

Hoooo no it's my fault!

I used to put the DSN string into a Play Framework template and it requires to escape the @ so I put a double @@ into the DSN string.

However, it seems to me there is a problem when you throw a RavenConfigError as it requires me to debug to get the reason

@benvinegar
Copy link
Contributor

Do you have a sample page?

I just tried browserify-ing the following code:

Raven.config('http://foo@@example.com/1').install();

And, using the same Raven script (1.1.15), I get the following:

Uncaught RavenConfigError: Invalid DSN: http://foo@@example.com/1

@slorber
Copy link
Author

slorber commented Mar 25, 2015

Hi @benvinegar .

My DSN string is not as simple as yours

    Raven.config('https://a92f6c9edba00000000255132945c7e2@@app.getsentry.com/38297',options).install();

I replaced some DSN parts but this is what I had when the error occured.
Maybe try to include the password? Because I did also attempt to put the password in the DSN to try...

@benvinegar
Copy link
Contributor

Yeah, I don't think the format of the DSN matters (although I did try a real one w/ the same errant @@). The parsing is wrapped in a big try/catch.

Really feels like an environment thing.

@mattrobenolt
Copy link
Contributor

Yeah, I'm not entirely sure how you'd get that error. If you can provide a failing test case or something, I'd happily take a look.

What you pointed to is wrapped in a try/catch as @benvinegar said: https://github.com/getsentry/raven-js/blob/master/src/raven.js#L406-L410

So you should be able to put in complete garbage for a DSN and still get a RavenConfigError back.

Until this can be reproduced with something in jsfiddle or a test case, I'm closing this as invalid.

@slorber
Copy link
Author

slorber commented Mar 25, 2015

oooh yeah @matthewwithanm @benvinegar actually I remember!
The original error says Cannot read property '6' of null and it is catched by the try/catch.

But when rethrowing, I just got:

Error
    at http://localhost:8080/appLibs.js:77951:30
    at Object.require.raven-js (http://localhost:8080/appLibs.js:78366:3)
    at s (http://localhost:8080/appLibs.js:1:262)
    at s (http://localhost:8080/app.js:1:142)
    at s (http://localhost:8080/app.js:1:122)
    at http://localhost:8080/app.js:1:313
    at Object.require.app.appConstants (http://localhost:8080/app.js:47956:13)
    at s (http://localhost:8080/app.js:1:262)
    at http://localhost:9000/:16171:30 

It is like there was a problem during the rethrow, a bit like if the code was:

 try {
        while (i--) dsn[dsnKeys[i]] = m[i] || '';
    } catch(e) {
        throw new Error();
    }

I don't know so much Javascript, just thought it may be related to this line: RavenConfigError.prototype = new Error();

During my tests I used an up-to-date chrome version on Ubuntu, and my app use Browserify

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

No branches or pull requests

3 participants