-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Sentry SVELTEKIT_DEV is not defined error #9252
Comments
Hi @MisterChaneb thanks for writing in! According to your stacktrace, this seems to be coming from within the As it happens, I just created another SvelteKit default app (Sverdle) and added our SDKs. Still not able to reproduce this.
Can you share a minimal reproducible example (e.g. GH repo) that reproduces this bug? |
I think I found a potential loose end for this issue in case anyone else is stuck! My app has one particularly slow Vite plugin that wraps up our legacy express server as middleware. Removing that plugin in vite.config stops this error. Adding a 10ms wait before calling It's a little odd that a slow server-side plugin is causing a clientside race condition, but my best guess is that So for anyone else who's runnning into this, check your plugins. There's probably something gumming up Vite's initialization clientside. |
I don't have any server-side vite plugins other than the sveltekit and sentry plugins, but the delay still fixed the issue for me. It seemed to only happen once in every 10 refreshes for me prior, haven't seen it since adding the delay. |
@kfajdsl Did you use a |
That's pretty close to what I did. Since it only affects dev, I have a little promisified export async function initSentry() {
if (dev) await wait(1)
Sentry.init({ ... })
/* etc etc... */
} And call that at the top of hooks.client. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/sveltekit
SDK Version
7.74.0
Framework Version
sveltekit 1.25
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
Expected Result
No error!
Actual Result
the error! this is local.
stores.js?v=ffd779d4:35 Uncaught (in promise) ReferenceError: SVELTEKIT_DEV is not defined
at Object.subscribe (stores.js?v=ffd779d4:35:17)
at instrumentPageload (router.ts:51:1)
at svelteKitRoutingInstrumentation (router.ts:27:1)
at BrowserTracing.setupOnce (browsertracing.ts:259:1)
at setupIntegration (integration.ts:105:1)
at integration.ts:93:1
at Array.forEach ()
at setupIntegrations (integration.ts:90:1)
at BrowserClient.setupIntegrations (baseclient.ts:297:1)
at Hub.bindClient (hub.ts:134:1)
at initAndBind (sdk.ts:34:1)
at init (sdk.ts:122:1)
at init2 (sdk.ts:24:1)
at Module.init3 (sdk.ts:30:1)
at hooks.client.js:4:8
The text was updated successfully, but these errors were encountered: