Repository navigation
Closed
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- 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/cloudflare
SDK Version
8.47.0
Framework Version
wrangler: 3.99.0
Link to Sentry event
https://hyperbyte.sentry.io/issues/15388878/events/6faf01ca3f04449081bf9dab43025a33/
Reproduction Example/SDK Setup
index.js
export default Sentry.withSentry(
(env: Env) => ({
dsn: env.SENTRY_DSN,
// Set tracesSampleRate to 1.0 to capture 100% of spans for tracing.
tracesSampleRate: env.SENTRY_TRACES_SAMPLE_RATE,
environment: 'production'
}),
{
async fetch(request: Request, env, ctx): Promise<Response> {
const configParse = configSchema.safeParse(env);
if (!configParse.success) {
return configErr(configParse.error, env);
} else {
env = configParse.data;
}
globalThis.env = env;
// globalThis.prisma = prismaFactory(env.DATABASE_URL);
globalThis.db = getDB(env.DATABASE_URL);
return fetchRequestHandler({
endpoint: '/trpc',
req: request,
router: appRouter,
createContext
});
}
} satisfies ExportedHandler<Env>
);
error-generating-file.js
Sentry.captureException(result.error);
rollup.config.js
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import json from '@rollup/plugin-json';
import { sentryRollupPlugin } from '@sentry/rollup-plugin';
export default {
input: 'src/index.ts', // Path to your main entry file,
output: {
file: 'dist/worker.js', // Output path for your bundled worker
format: 'es', // Cloudflare Workers support ES Modules
sourcemap: true,
inlineDynamicImports: true
},
plugins: [
resolve(), // Resolve node modules
commonjs(),
json(),
typescript({
tsconfig: './tsconfig.json'
}),
terser(), // Minify the output (optional)
sentryRollupPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: '------',
project: '--------'
})
]
};
wrangler.toml
upload_source_maps = true
[build]
#custom build command
command = "npm run build"
Steps to Reproduce
- Add sentry
@sentry/cloudflare - Setup init
- Test using
Sentry.captureException() - Setup rollup
Expected Result
- Compiled code includes
e._sentryDebugIds=e._sentryDebugIds||{} - Issue reported to sentry
- Issue Stack-trace visible
- Issue Stack-trace un-minified
- event json does not include
debug_meta
Actual Result
- Compiled code includes
e._sentryDebugIds=e._sentryDebugIds||{} - Issue reported to sentry
- Issue Stack-trace visible
- Issue Stack-trace un-minified
- event json does not include
debug_meta
i have checked the event json and it does not contain debug_meta
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsNo status

Activity
andreiborza commentedon Dec 27, 2024
Hi @bhanuka-yd, thanks for writing in.
Could you please set
debug: truein the rollup plugin and paste some build logs?bhanuka-yd commentedon Dec 27, 2024
Hi @andreiborza, sure here's the output.
rollup -c rollup.config.mjs
[sentry-rollup-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".
src/index.ts → dist/worker.js...
[sentry-rollup-plugin] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set
options.telemetrytofalse.[sentry-rollup-plugin] Debug: No
sourcemaps.assetsoption provided, falling back to uploading detected build artifacts.Source Map Upload Report
Scripts
~/167414e4-08a0-4d95-a51f-9efdaa05e16a-0.js (sourcemap at worker.js.map, debug id 167414e4-08a0-4d95-a51f-9efdaa05e16a)
Source Maps
~/167414e4-08a0-4d95-a51f-9efdaa05e16a-0.js.map (debug id 167414e4-08a0-4d95-a51f-9efdaa05e16a)
[sentry-rollup-plugin] Info: Successfully uploaded source maps to Sentry
(!) Circular dependencies
node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js -> node_modules/@smithy/util-stream/dist-es/blob/transforms.js -> node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js
node_modules/@aws-crypto/crc32c/build/module/index.js -> node_modules/@aws-crypto/crc32c/build/module/aws_crc32c.js -> node_modules/@aws-crypto/crc32c/build/module/index.js
node_modules/@aws-crypto/crc32/build/module/index.js -> node_modules/@aws-crypto/crc32/build/module/aws_crc32.js -> node_modules/@aws-crypto/crc32/build/module/index.js
...and 7 more
created dist/worker.js in 23.1s
Total Upload: 1716.87 KiB / gzip: 320.36 KiB
Worker Startup Time: 82 ms
Lms24 commentedon Jan 2, 2025
Hi @bhanuka-yd, I didn't find anything yet that would prohibit debug ids from being applied to error events. Before we dig into this deeper: Can you confirm that the files where debug ids were injected correctly are the exact same files that get deployed to cloudflare? The
debug_metafield in the event JSON can only be populated, if the deployed files contain thee._sentryDebugIdssnippet.If this is the case, we need to dive deeper into SDK internals to understand what's going on. If you can, please provide a minimal reproduction, for example in the form of a GH repo, zip file or whatever else works for you.
If you can't, please
console.logsome things:beforeSend, please log outeventandevent.exception.valuesso that we can check what the SDK sends exactly. Sometimes, the event JSON in the Sentry UI already contains slight changes.beforeSend, please also log outglobalThis._sentryDebugIdsso that we can check if the SDK could even pick up debug ids.Side-note: I did find a bug in our debug id application logic but it's rather an edge case, where debug ids were not correctly applied to events containing multiple errors. However I don't think this has anything to do with your problem. Anyway, the found bug will be fixed via #14881.
23 remaining items
[-]@sentry/cloudflare not sending debugIds ?[/-][+]Add docs and wizard to configure sourcemaps for cloudflare + wrangler[/+]AbhiPrasad commentedon Jun 10, 2025
should be done with getsentry/sentry-wizard#824
Create wrangler sourcemaps guide for Cloudflare (#14089)
Create wrangler sourcemaps guide for Cloudflare (#14089)