You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@sentry/sveltekit initCloudflareSentryHandle throws error when building/deploying to cloudflare pages #16613
The reproduction uses cloudflare's wrangler pages dev command to trigger the error locally, but the same error occurs when deploying to cloudflare pages (cloudflare pages prevents the upload as a result of the issue).
The sentry setup is not "correct"/"complete" in the example, to illustrate the entry point for the issue (which appears to be the initCloudflareSentryHandle function in src/hooks.server.js).
Steps to Reproduce
pnpm run build wrangler pages dev
Expected Result
should build/run/deploy without issue
Actual Result
When running wrangler pages dev the following error is thrown:
⛅️ wrangler 4.20.0
───────────────────
✘ [ERROR] Build failed with 1 error:
✘ [ERROR] Could not resolve "minimatch"
../output/server/chunks/hooks.server.js:24793:34:
24793 │ globMatcher = require("minimatch").minimatch;
╵ ~~~~~~~~~~~
You can mark the path "minimatch" as external to exclude it from the bundle, which will
remove this error and leave the unresolved path in the bundle. You can also surround this
"require" call with a try/catch block to handle this failure at run-time instead of
bundle-time.
✘ [ERROR] Failed to build _worker.js.
I'm so sorry, this one is my fault. We recently started bundling dependencies that declare a dependency on SvelteKit but that would mean the Node version of Sentry is getting bundled before the Wrangler bundling kicks in. This should be fixed when we merge sveltejs/kit#13894 to revert that bundling
Reacted by matindow, Francesco Gringl-Novy, Andrei and Lukas Stracke
Sure thing! In the meantime, if you want to avoid downgrading your packages, the very simple workaround is to add @sentry/sveltekit to the ssr.external option in vite.config.ts to prevent Vite from bundling it in. sveltejs/kit#13869 (comment)
Activity
matindow commentedon Jun 17, 2025
Same issue with sentry 9.30.0 and wrangler 4.20.1. I have updated the dependencies in the example repo.
teemingc commentedon Jun 18, 2025
I'm so sorry, this one is my fault. We recently started bundling dependencies that declare a dependency on SvelteKit but that would mean the Node version of Sentry is getting bundled before the Wrangler bundling kicks in. This should be fixed when we merge sveltejs/kit#13894 to revert that bundling
mydea commentedon Jun 18, 2025
@eltigerchino thanks for the update 🙏 can you let us know when this is merged/released? Thank you!
teemingc commentedon Jun 18, 2025
Sure thing! In the meantime, if you want to avoid downgrading your packages, the very simple workaround is to add
@sentry/sveltekitto thessr.externaloption invite.config.tsto prevent Vite from bundling it in.sveltejs/kit#13869 (comment)
4 remaining items
teemingc commentedon Jul 8, 2025
I think it's mostly complete. cc: @elliott-with-the-longest-name-on-github is there anything else we need to do before marking it as ready or to merge it?
teemingc commentedon Jul 9, 2025
sveltejs/kit#13971 should fix this as well
Lms24 commentedon Jul 9, 2025
Nice, thanks for the update! 🙏
teemingc commentedon Jul 10, 2025
Updating to SvelteKit 2.22.4 should fix this!
Relevant release notes:
Lms24 commentedon Jul 10, 2025
Thanks for shipping this @eltigerchino!
Can confirm that the newest Kit version works again in the repro from #16818 (cc @RaniSputnik).
Closing this for the moment, please let us know if anyone still experiences a problem!