Skip to content

Bail if XMLHttpRequest is unavailable #1023

@jyoko

Description

@jyoko

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

_makeRequest ( https://github.com/getsentry/raven-js/blob/master/src/raven.js#L1793 ) uses a bare XMLHttpRequest. The specific issue I'm seeing comes from Raven.js being run with Ember Fastboot, in Node, where XMLHttpRequest doesn't exist. The call throws an error and causes the application to crash. Inconveniently a crash here swallows the original error.

I unfortunately don't have minimal demo but if you have a Fastboot application with Raven, have the application throw an error to Raven during the render and you'll see the issue. You can probably see the same behavior in the browser by deleting the global XMLHttpRequest.

What is the expected behavior?

Lots of more permanent solutions available, several of which are already being discussed in the tracker here and elsewhere on the Ember/Fastboot side. The immediate bugfix is to guard against using a non-existent variable and bail out of _makeRequest if XHR isn't available. This is already done as part of the breadcrumb instrumenting ( https://github.com/getsentry/raven-js/blob/master/src/raven.js#L1088 ). I'll edit this to include a link to a PR, it's a simple two-line change.

PR here: #1024

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions