getsentry / getsentry/sentry-javascript

[NUXT / CLOUDFLARE] index.js fail symbolication with js_invalid_sourcemap_location

Open
#20,051 11 comments 1 reaction 0 assignees View on GitHub
Bug Cloudflare Workers External Dependency Nuxt State: Blocked
Dominant language
TypeScript
Stars
8.7k
Forks
1.8k
Avg merge
1d 17h
Merged PRs (30d)
515

Description

### Is there an existing issue for this?

- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

### How do you use Sentry?

Sentry Saas (sentry.io)

### Which SDK are you using?

@sentry/nuxt

### SDK Version

@sentry/nuxt@10.46.0 (Runtime SDK from event: sentry.javascript.cloudflare@10.46.0)

### Framework Version

nuxt@4.4.2 (nitro 2.13.1, vite 7.3.1)

### Link to Sentry event

https://onderwijsin.sentry.io/issues/108852209/events/bb69ef6fca274801982458474a2770ed?project=4511135217352784

### Reproduction Example/SDK Setup

You can find the repo we are working from at https://github.com/onderwijsin/regional-site-menu
On [this branch](https://github.com/onderwijsin/regional-site-menu/tree/upload-final-output) we tried a post deploy upload of the final build output.

```ts
// sentry.client.config.ts
import * as Sentry from '@sentry/nuxt'

const runtimeConfig = useRuntimeConfig()

Sentry.init({
dsn: runtimeConfig.public.sentry?.dsn,
release: runtimeConfig.public.sentry?.release,
environment: runtimeConfig.public.sentry?.environment,
debug: runtimeConfig.public.mode.isDebug,
sampleRate: 1.0,
sendDefaultPii: true,
enhanceFetchErrorMessages: 'report-only',
integrations: [
Sentry.replayIntegration(),
Sentry.zodErrorsIntegration(),
Sentry.httpClientIntegration()
],
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.2,
replaysOnErrorSampleRate: 1.0
})
```

```ts
// server/plugins/sentry-cloudflare-plugin.ts
import * as Sentry from '@sentry/nuxt'
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins'

export default defineNitroPlugin(
sentryCloudflareNitroPlugin(() => {
const runtimeConfig = useRuntimeConfig()
return {
dsn: runtimeConfig.public.sentry?.dsn,
release: runtimeConfig.public.sentry?.release,
environment: runtimeConfig.public.sentry?.environment,
debug: runtimeConfig.public.mode.isDebug,
sampleRate: 1.0,
tracesSampleRate: 1.0,
integrations: [Sentry.zodErrorsIntegration()]
}
})
)
```

Nuxt config relevant bits:

- `modules: ['@sentry/nuxt/module']`
- `sourcemap: { client: 'hidden' }`
- `sentry.sourcemaps.disable = process.env.SENTRY_UPLOAD_SOURCE_MAPS !== 'true'`

### Steps to Reproduce

1. Configure Nuxt + Cloudflare per docs (@sentry/nuxt/module + sentryCloudflareNitroPlugin).
2. Build and deploy to Cloudflare Workers preview (nitro.preset=cloudflare_module).
3. Trigger a server error via a test route (GET /api/_sentry/test).
4. Open event JSON in Sentry.

### Expected Result

Server-side stack traces are symbolicated with source context (like client-side), no sourcemap-location errors.

### Actual Result

Server-side event remains unsymbolicated with:
- `abs_path: "/index.js"`
- `errors[].type = "js_invalid_sourcemap_location"`
- `symbolicator_type = "invalid_location"`

Latest event JSON shows:
- `debug_meta.images[0].code_file = "/index.js"`
- `debug_meta.images[0].debug_id = "7291620e-42c4-4937-a5a9-da6200edff2f"`

### Additional Context

From CI logs for the same release (`8e4b06b51f0d5342381499ad722c66aa4ac91a33`):
- Sentry Nuxt build-time uploads include chunk artifact with debug ID:
- `7291620e-42c4-4937-a5a9-da6200edff2f` -> `test.get.mjs.map`
- Final Wrangler bundle upload (custom step) includes:
- `~/index.js (sourcemap at index.js.map, debug id a6c0872b-5194-5c5c-b067-5bf082cdc965)`

So runtime frames are `/index.js`, but event debug ID still points to a pre-Wrangler chunk debug ID, and symbolication fails with `js_invalid_sourcemap_location`.

Questions:
1. For Nuxt Cloudflare (`cloudflare_module`), should `@sentry/nuxt` support final Worker bundle sourcemaps out-of-the-box?
2. Is `/index.js` expected to be valid for symbolication in this setup, or is additional path normalization required?
3. What is the recommended official CI flow to ensure deployed Worker code and uploaded sourcemaps/debug IDs are guaranteed to match?

### Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.