Sentry-javascript: Cors issue on capturing exceptions

Created on 28 Aug 2020  路  3Comments  路  Source: getsentry/sentry-javascript

Package + Version

  • [x] @sentry/react
  • [x] @sentry/browser
  • [ ] @sentry/node
  • [ ] raven-js
  • [ ] raven-node _(raven for node)_
  • [] other:

Version: "@sentry/react": "^5.22.0",

0.0.0

Description

I have a simple setup to capture events to sentry, like below

// import * as Sentry from "@sentry/browser"; // same with this package
import * as Sentry from "@sentry/react";
Sentry.init({
  dsn: "https://[email protected]/1319034",
  release: "my-project-name@" + process.env.npm_package_version,
});

const logError = (error) => {
  Sentry.captureException(error);
};

function App() {
  logError(new Error("from create-react-app"));

  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

but request to sentry ended up being 403 (forbidden) and it's because of CORS, Any one has same problem ?

In Progress

Most helpful comment

I was having this CORS error as well too and it turned out my ad blocker (uBlock Origin on Firefox OSX) was blocking connection to Sentry.

All 3 comments

Hey @karna41317 - in your Sentry account, double check these settings:

  • Project Settings -> General Settings -> Allowed Domains
  • Project Settings -> Inbound Filters -> Filter out events coming from localhost (if you're noticing this during local development)

I was having this CORS error as well too and it turned out my ad blocker (uBlock Origin on Firefox OSX) was blocking connection to Sentry.

Closing the issue as a part of large repository cleanup, due to it being inactive and/or outdated.
Please do not hesitate to ping me if it is still relevant, and I will happily reopen and work on it.
Cheers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dimmduh picture dimmduh  路  3Comments

zivl picture zivl  路  3Comments

kishor-bhatt picture kishor-bhatt  路  3Comments

jaylinski picture jaylinski  路  3Comments

THPubs picture THPubs  路  3Comments