Skip to content

"Error: Invalid Dsn" when using an IPv6 URL #2996

Description

@progval

Important Details

How are you running Sentry?

  • On-Premise docker [Version 10.0.0.dev0]
  • Saas (sentry.io)
  • Other [briefly describe your environment]

Description

When using an IPv6 URL (eg. http://[::1]:9000) to connect to Sentry for the first time, any further access to the web interface will crash with "Error: Invalid Dsn"

I believe this is caused by this regexp, which accepts IPv4 addresses in DSNs, but not IPv6 addresses:

const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;

Steps to Reproduce

  1. git clone https://github.com/getsentry/onpremise.git
  2. cd onpremise; ./install.sh
  3. open http://[::1]:9000
  4. login
  5. accept the configuration form with default values
  6. wait for a bit
  7. reload page

Page is stuck on :

Please wait while we load an obnoxious amount of JavaScript.
You may need to disable adblocking extensions to load Sentry

with this stack traces in the web browser console (note: it's with the IP address I actually used in my install instead of ::1):

Error: Invalid Dsn vendor.js:52:2489
    t http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:52
    _fromString http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:151
    e http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:151
    e http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:78
    e http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:73
    t http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:103
    _setupTransport http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:78
    e http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:103
    t http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:78
    e http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:103
    t http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:78
    p http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:78
    d http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/vendor.js:45
    <anonyme> http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    i http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    i http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    <anonyme> http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    i http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    n http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    <anonyme> http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
    <anonyme> http://[fdfe:4927:30e1:5af9:2eb7:f8be:893b:9f0b]:9000/_static/1575887347/sentry/dist/app.js:1
ReferenceError: $ is not defined issues:64:3

What you expected to happen

The Sentry dashboard should load

Possible Solution

Update DSN_REGEX to allow IPv6 addresses: var DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.[:\]-]+)(?::(\d+))?\/(.+)/;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions