Skip to content

Sentry SVELTEKIT_DEV is not defined error #9252

@MisterChaneb

Description

@MisterChaneb

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

import { handleErrorWithSentry, Replay } from "@sentry/sveltekit";
import * as Sentry from '@sentry/sveltekit';

Sentry.init({
  dsn: 'https://3c0a82d0a6fb34aa51085ba824e98e86@o4506019657154560.ingest.sentry.io/4506050175434752',
  tracesSampleRate: 1.0,

  // This sets the sample rate to be 10%. You may want this to be 100% while
  // in development and sample at a lower rate in production
  replaysSessionSampleRate: 0.1,

  // If the entire session is not sampled, use the below sample rate to sample
  // sessions when an error occurs.
  replaysOnErrorSampleRate: 1.0,
  
  // If you don't want to use Session Replay, just remove the line below:
  integrations: [new Replay()],
});

// If you have a custom error handler, pass it to `handleErrorWithSentry`
export const handleError = handleErrorWithSentry();

Steps to Reproduce

  1. create a base project of sveltekit
  2. install sentry!
  3. refresh the page multiple times until you get the error
  4. Huray reproduced!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: sveltekitIssues related to the Sentry SvelteKit SDK

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions