Skip to content

TypeError: options.headers.get is not a function #6552

@aaditya-ghag-mt

Description

@aaditya-ghag-mt

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/react

SDK Version

6.13.2

Framework Version

17.0.0

Link to Sentry event

No response

Steps to Reproduce

On our react app, we're getting one error on safari browser and it's a single client specific issue. Same react app works on our end on safari browser. All our GraphQL api's are failing also all fetch api calls are failing. I spent a huge amount of time debugging the issue but wasn't able to replicate.

Error:
TypeError
options.headers.get is not a function. (In 'options.headers.get(key)', 'options.headers.get' is undefined)

The error stack is pointing out to this code

      return originalFetch.apply(global, args).then(
        (response: Response) => {
          triggerHandlers('fetch', {
            ...handlerData,
            endTimestamp: Date.now(),
            response,
          });
          return response;
        },
        (error: Error) => {
          triggerHandlers('fetch', {
            ...handlerData,
            endTimestamp: Date.now(),
            error,
          });
          // NOTE: If you are a Sentry user, and you are seeing this stack frame,
          //       it means the sentry.javascript SDK caught an error invoking your application code.
          //       This is expected behavior and NOT indicative of a bug with sentry.javascript.
          throw error;
        },
      );

This code is from transports/instrument.ts of Sentry's source code.

From what I'd debug I feel as sentry is intercepting every request so due to some polyfill issue for native fetch, can this error occur ? Any help ?

Expected Result

Should work on safari browser!

Actual Result

Not working on safari browser!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions