'Bugsnag from a browser: is there a way I can add my own header?

Using "@bugsnag/browser": "7.5.6"

I have configured bugsnag to send requests to a custom endpoint by doing:

Bugsnag.start({
  ...
  autoTrackSessions: false,
  endpoints: {
    notify: 'htts://custom-notify-url.example.com',
    sessions: 'https://bugsnag-sessions.example.com', 
  },
  onError: async function (event: any) {
    console.log("bugsnag error event", event);
  },
})

This works, and sends requests to custom-notify-url.example.com

But I need the bugsnag requests to have a specific header.

Is it possible to configure bugsnag so that it applies a custom header to the notification POST request?



Solution 1:[1]

Bugsnag's error reporting API, which is what all of their libraries use, doesn't support passing custom fields in the header. If you are ultimately forwarding events to notify.bugsnag.com, you will not be able to have a custom header - you also can't override the header for a custom endpoint.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bsud