Skip to content

Http client errors not sent when relay is hosted on the same domain. #17385

@rodolfoBee

Description

@rodolfoBee

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

9.40.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Configure relay to listen to events on my.domain.com.
  2. Configure the SDK to send events via relay.
  3. Trigger 5xx errors when sending Fetch or XHR requests to my.domain.com

Expected Result

The SDKs HttpClient integration detects the error and sends via relay. The SDK logs when relay is hosted on a different domain (for example, my.ingest.domain.com):

POST https://my.domain.com/api/v1/.... 500 (Internal Server Error)
Sentry Logger [log]: Captured error event `HTTP Client Error with status code: 500`

Actual Result

The SDK does not send the event to relay when it is hosted in the same domain. The SDK logs do not show the entry Sentry Logger [log]: Captured error event HTTP Client Error with status code: 500` after the error:

POST https://my.domain.com/api/v1/.... 500 (Internal Server Error)
Sentry Logger [log]: Flushing outcomes...
Sentry Logger [log]: Sending outcomes: [{…}]0: {reason: 'sample_rate', category: 'transaction', quantity: 1}length: 1[[Prototype]]: Array(0)
Fetch finished loading: POST "https://my.domain.com/api/[PROJ_ID]/envelope/?sentry_version=7&sentry_key=[KEY_ID]&sentry_client=sentry.javascript.react%2F9.40.0".

In resume:
Does not work on shared domain name:

  • Application domain: my.domain.com
  • Sentry relay: my.domain.com/sentry/

or

  • Application domain: my.app.domain.com
  • Sentry relay: my.app.domain.com/sentry/

Does work on mixed domain names:

  • Application domain: my.domain.com
  • Sentry relay: my.ingest.domain.com/sentry/

or

  • Application domain: my.app.domain.com
  • Sentry relay: my.domain.com/sentry/

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions