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

Tunnel sometimes doesn't receive a DSN in the payload #4088

Closed
max-wittig opened this issue Oct 26, 2021 · 5 comments
Closed

Tunnel sometimes doesn't receive a DSN in the payload #4088

max-wittig opened this issue Oct 26, 2021 · 5 comments

Comments

@max-wittig
Copy link

Environment

How do you use Sentry?
self-hosted 21.09.

Which SDK and version?
Angular SDK, maybe this issue belongs to the Angular SDK, not sure.

    "@sentry/angular": "^6.13.2",
    "@sentry/tracing": "^6.13.2",

Steps to Reproduce

  1. Setup sentry tunnel in the Angular App, like officially described
  2. Produce crash
  3. Wait for user dialog
  4. Observe 403 thrown by the upstream Sentry

Expected Result

I expected the payload to always include the upstream DSN. But it looks like this, when the user sees a
user feedback error page:

{}
{"type":"client_report"}
{"timestamp":1635253668.001,"discarded_events":[{"reason":"event_processor","category":"error","quantity":1}]}

What should I do as a tunnel here? Drop those events?

Actual Result

I would expect that every request includes a DSN in the first line, so that it can be parsed and forwarded to Sentry.

envelope = request.data
piece = envelope.split("\n")[0]
header = json.loads(piece)
dsn = urllib.parse.urlparse(header.get("dsn"))  # header.get("dsn") is empty, ParseResultBytes(scheme=b'', netloc=b'', path=b'', params=b'', query=b'', fragment=b'')
project_id = str(dsn.path).strip("/")
url = f"{settings.SENTRY_URL}/api/{project_id}/envelope/"
response = requests.post(url=url, data=envelope)  # this causes Sentry to throw a 403, <title>CSRF Verification Failed | Sentry</title>

In all other cases the payload looks correct:

{"event_id":"cdc681cf948044df86284138f4e0f21a","sent_at":"2021-10-26T13:07:49.262Z","sdk":{"name":"sentry.javascript.angular","version":"6.13.2"},"dsn":"https://0ef913cb946547adb7658bad4fbf96fe@localhost.com/87"}
{"type":"event","sample_rates":[{}]}
{"exception":{"values":[{"type":"Error","value":"Non-Error exception captured with keys: erro...}]}}
@max-wittig max-wittig changed the title Tunnel sometimes doesn't get a DSN in the payload Tunnel sometimes doesn't receive a DSN in the payload Oct 26, 2021
@bruno-garcia bruno-garcia transferred this issue from getsentry/examples Oct 26, 2021
@AbhiPrasad
Copy link
Member

This should be fixed by #4031, which should be available in the next release. For now you can drop these events until we get that release out.

@max-wittig
Copy link
Author

Nice! Thanks 👍

@oystein-beaufort
Copy link

Is this something that will be released soon? :)

@AbhiPrasad
Copy link
Member

yup as part of SDK version 6.14.0. Too see progress on when that release will be cut, monitor getsentry/publish#629. When that issue is closed/accepted, the release will pushed to npm.

@AbhiPrasad
Copy link
Member

Release has been cut https://www.npmjs.com/package/@sentry/browser/v/6.14.0 :)

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