Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Origin on request headers causes sentry-electron to crash Electron #176

Closed
timfish opened this issue Jul 16, 2019 · 1 comment · Fixed by #194
Closed

Setting Origin on request headers causes sentry-electron to crash Electron #176

timfish opened this issue Jul 16, 2019 · 1 comment · Fixed by #194

Comments

@timfish
Copy link
Collaborator

timfish commented Jul 16, 2019

Many APIs will reject requests without an Origin header, or an Origin set to file://*. To mitigate this in Electron, it's common to add a dummy Origin header like this:

app.on('ready', () => {
  session.defaultSession.webRequest.onBeforeSendHeaders(
    (details: any, callback: any) => {
      details.requestHeaders.Origin = 'www.some-random-origin.com';
      callback({ cancel: false, requestHeaders: details.requestHeaders });
    }
  );
});

With the above, sentry-electron@0.17.1 will immediately crash on attempting to upload a minidump which will usually be during startup..

This regression is no doubt due to a recent change to electron-fetch:

v1.2.0

  • Using electron's defaultSession by default
@timfish
Copy link
Collaborator Author

timfish commented Jul 16, 2019

Once I disabled adding this header, Sentry uploaded this crash which looks like this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant