Sentry errors on active target change

I am using Sentry to collect errors using @tbvgl advanced logger extension, which uses an ENV variable to indicate it should be enabled. I also have a server start routine that uses Axios to call a local api.

I do not have this ENV set in my DEV environment, but do have it set on STAGING.

This all works, however as I am developing and then pushing to a remote target, problems occur…

If I start on DEV, and I have a browser window open using the localhost DEV server, and then switch the active target to STAGING, a series of timeout errors start throwing to Sentry.

What I believe is happening is that because STAGING is active, Sentry is enabled from the perspective of the editor/localhost.

And because the browser remains open and is expecting a DEV server, DB timeouts are thrown.

Is there a way to avoid these errors and keep Sentry clean?

Perhaps related to: