Sometimes sentry doesn't work

I’m using react app. I added init sentry in the root file
In the getSentryDsn function I get dsn url depend on the env variable.
I added test error with this code: <button onClick={methodDoesNotExist}>Break the world</button>
The first time error saved in the sentry, but after this error not saved again.
After this i changed name of function in the button to: <button onClick={error}>error</button> and error not saved anyway. Thanks for the help.

I recommend using the built-in Environments configuration option rather than changing the DSN based on the environment.

Regarding what you are observing, I think Sentry still records the error and increases the event count but does not register it as a new issue unless the code signature is changed as we group events by their stacktrace.

thank you. will try