Skip to content

Capturing CORS Errors #8342

Closed Answered by AbhiPrasad
Pekito asked this question in Q&A
Jun 15, 2023 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

As per the cors errors docs

Note: For security reasons, specifics about what went wrong with a CORS request are not available to JavaScript code. All the code knows is that an error occurred. The only way to determine what specifically went wrong is to look at the browser's console for details.

This means we can't programmatically capture when cors errors occur. What we can instead do is to use the CaptureConsole integration to send console warnings/errors to Sentry. Note that you might have to add some preemptive filtering if you have a noisy console.

EDIT: My above comment is incorrect, you don't have access to CORS errors programmatically from the browser.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gnoyixiang
Comment options

@AbhiPrasad
Comment options

Answer selected by Pekito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants