Skip to content

Setup instructions for Cloudflare workers and Sveltekit lead to broken installation #16818

Open
@RaniSputnik

Description

@RaniSputnik

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare

SDK Version

9.35.0

Framework Version

Sveltekit 2.16.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/RaniSputnik/sentry-issues/tree/enable-not-a-function

Steps to Reproduce

  1. Follow the getting started guide for a new Sveltekit app, including using the Cloudflare adapter.
  2. Run npx @sentry/wizard@latest -i sveltekit
  3. Follow Cloudflare + Sveltekit specific setup instructions
  4. Add a minimal wrangler.toml:
name = "some-project-name"
main = ".svelte-kit/cloudflare/_worker.js"
compatibility_date = "2025-01-01"

compatibility_flags = ["nodejs_compat"]
version_metadata = { binding = "CF_VERSION_METADATA" }

[assets]
binding = "assets"
directory = ".svelte-kit/cloudflare"

[observability]
enabled = true
head_sampling_rate = 1

Expected Result

My setup is functional. I can use the Sentry test error page to trigger client side + server side errors.

Image

Actual Result

Symptom 1

I get intermittent 500's when trying to load the page with the following error in the logs:

TypeError: this.enable is not a function
    at new InstrumentationBase (_worker.js:17457:16)
    at new SentryHttpInstrumentation (_worker.js:28603:9)
    at _worker.js:28871:16
    at Object.assign.id (_worker.js:20577:31)
    at Object.setupOnce (_worker.js:28892:11)
    at setupIntegration (_worker.js:5979:17)
    at _worker.js:5960:7
    at Array.forEach (<anonymous>)
    at setupIntegrations (_worker.js:5958:16)
    at NodeClient._setupIntegrations (_worker.js:6576:30)
Image

Symptom 2

I see 400's in the browser on every page load when posting to https://o447951.ingest.sentry.io:

{"detail":"bad sentry DSN public key","causes":["invalid project key"]}
Image

Symptom 3

The Sentry example page raises and error client side and posts to an API route that also errors. It should produce two errors, one from the client and one from the server. Client errors are being reported, server errors are not:

Image

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions