Skip to content

Unable to use regexes as networkDetailAllowUrls parameters #50919

@JEricaM

Description

@JEricaM

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

Hi to everyone
I'm using sentry in my typescript saas that I've developer.

When initializing Sentry, I add the following parameters (https://docs.sentry.io/platforms/javascript/session-replay/configuration/):

networkDetailAllowUrls
networkRequestHeaders
networkResponseHeaders
networkCaptureBodies

Since my SaaS has both a production and a test environment, I need to validate two different API endpoints.
https://api.staging.eu
https://api.production.eu

As a result, I need to use two regex patterns to monitor these two URLs in all their variations.
Therefore, I have set up the regex patterns as you can see below.

        integrations: [new BrowserTracing(), new Sentry.Replay({
            [...]
            networkDetailAllowUrls: [window.location.origin, '^https:\/\/api\.staging\.eu(\/.*)?$', '^https:\/\/api\.production\.eu(\/.*)?$'],
            networkRequestHeaders: ["Cache-Control"],
            networkResponseHeaders: ["Referrer-Policy"],
            networkCaptureBodies: true,
        },)],

The problem is that these regex patterns don't seem to be working because for each issue monitored by Sentry, it tells me to add the specific API URL in order to be able to control it.

Add https://api.staging.eu/tenant/admin/.... to your networkDetailAllowUrls list to start capturing data.

So I was wondering what I might be doing wrong. I tried the regex patterns on an online validator, and they work fine.

Expected Result

I expected that sentry can show me api's responses

Actual Result

Sentry ask to add the specif url to the networkDetailAllowUrls

Product Area

Replays

Link

No response

DSN

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status
    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions