Skip to content

browsingContextID is not set while using makeFetchTransport from Firefox version 133 #16064

Open
@ArulappanS

Description

@ArulappanS

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

8.7.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

import {
  BrowserClient,
  makeFetchTransport,
Scope,
} from '@sentry/browser'


let transport = makeFetchTransport;

const defaultConfig = {
  transport,..
}
const browserClient = new BrowserClient({
  ...defaultConfig,..
})

const serviceInstance = new Scope()
serviceInstance.setClient(browserClient)
.
browserClient.init()

serviceInstance.captureException(message, {
          captureContext: {
           .....
          }
})

Steps to Reproduce

Send the Sentry request (along with all the required options), using the sample code given.

Observation:
Getting the error in Firefox Parent process Browser Console:
Got a request https://sentry-*****************/&sentry_client=sentry.javascript.browser%2F8.7.0 without a browsingContextID set

Image

Sentry request is shown in the third-party proxy tools, e.g. Fiddler

Figured out that in Firefox 133, fetch API related bug fixes are made:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/133
Image

Workaround:
Tried with a custom fetch transport, the request is listed in the DevTools and no error in the browser console.

function makeCustomFetchTransport(options) {
  function makeRequest(request) {
    const requestOptions = {
      body: request.body,
      method: 'POST',
      referrerPolicy: 'origin',
      headers: options.headers,
      ...options.fetchOptions,
    };

    return fetch(options.url, requestOptions).then(response => ({
        statusCode: response.status,
        headers: {
          'x-sentry-rate-limits': response.headers.get('X-Sentry-Rate-Limits'),
          'retry-after': response.headers.get('Retry-After'),
        },
      }));
  }

  return createTransport(options, makeRequest);
}

It would be helpful if the support is given from Sentry SDK itself.

Expected Result

Sentry request is listed in Firefox DevTools.

Actual Result

Sentry request is not listed in the DevTools, but getting below error in the Firefox Parent process Browser console

Image

Note: Press CMD+Shift+J to open Firefox Parent process Browser console

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions