Reputation: 6096
When making a standard bugsnag request to Bugsnag Enterprise, Chrome shows me that the request was rejected by the server with a 405 response status.
Request Method:GET
Status Code:405 Method Not Allowed
Here's my code:
const script_tag = document.createElement('script');
script_tag.setAttribute('src', '//d2wy8f7a9ursnm.cloudfront.net/bugsnag-3.min.js');
document.head.appendChild(script_tag);
script_tag.onload = () => {
Bugsnag.apiKey = BUGSNAG_API_KEY;
Bugsnag.endpoint = '//exceptions.my-domain.com';
Bugsnag.notifyHandler = 'xhr';
const e = new Error('Test error!');
Bugsnag.notifyException(e);
}
(The reason I'm not using Bugsnag's data
attributes like data-apikey="..."
when inserting the tag is because that results in a warning from bugsnag: [Bugsnag] Invalid API key 'undefined'
, but that's a separate issue...)
The Bugsnag API docs say that errors should be sent via POST requests, so I'm not sure why Bugsnag's own Javascript library would be making a GET request.
How can I fix this issue?
Upvotes: 3
Views: 410
Reputation: 56
You'll need to append /js
to the end of your notifier endpoint when reporting Javascript.
We use a GET request (instead of POST) for a few reasons, mainly to support errors from legacy browsers. That said, this may change in the future.
Let me know if that fixes the issue!
-Kelly@Bugsnag
Upvotes: 3