getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.98k stars 1.57k forks source link

Deployment on Netlify using SvelteKit succeeding during build but failing during requests (Cannot find module '@sentry/bundler-plugin-core/sentry-release-injection-file') #9544

Closed kyllerss closed 3 months ago

kyllerss commented 12 months ago

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.80.0

Framework Version

1.25.2

Link to Sentry event

No response

SDK Setup

Sentry.init({
    dsn: <...>,
    tracesSampleRate: 1
});

Steps to Reproduce

Deploy a build in Netlify and access any of the site's URLs. I enabled Sentry integration through Netlify's UI. I also enabled GitHub integration.

I used the SvelteKit wizard CLI tool to enable code changes in the app. Local testing and building work fine.

Expected Result

Should be able to see the homepage without any issues.

Actual Result

The build and deploy process complete successfully, however when I access the site's homepage I get a 500 error. The serverside console shows the following error:

Nov 13, 01:36:38 PM: 164b4a7d ERROR  Error: Cannot find module '@sentry/bundler-plugin-core/sentry-release-injection-file'
Require stack:
- /var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
    at Function.resolve (node:internal/modules/cjs/helpers:125:19)
    at node_modules/@sentry/bundler-plugin-core/dist/cjs/index.js (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:77323:46)
    at __require2 (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:26:51)
    at node_modules/@sentry/vite-plugin/dist/cjs/index.js (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:77862:29)
    at __require2 (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:26:51)
    at node_modules/@sentry/sveltekit/cjs/vite/sourceMaps.js (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:83465:22)
    at __require2 (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:26:51)
    at node_modules/@sentry/sveltekit/cjs/vite/sentryVitePlugins.js (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:83632:22)
    at __require2 (file:///var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs:26:51) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/app/main/web/.netlify/functions-internal/sveltekit-render.mjs'
  ]
}
kyllerss commented 12 months ago

I may have stumbled upon what I assume is the cause: according to Sentry's SDK GitHub documentation, SvelteKit adapter-netlify is not listed as a supported target. This could be an example of an unfortunate coverage gap in feature support: Netlify is touting its Sentry support, while also explicitly supporting many frameworks (SvelteKit being one of them). I don't see anything in their documentation stating their support is partial.

Is this outdated documentation or am I out of luck?

lforst commented 11 months ago

I don't think adapter-netlify is supported as of now. I also don't think this is a priority for us at the moment so I wouldn't expect this to land too soon. PRs are always welcome!

I'll have @Lms24 confirm all of this though as he is our go-to person for all things SvelteKit.

Lms24 commented 11 months ago

Hi @kyllerss, @lforst is correct. Unfortunately, we don't have time to work on SvelteKit adapters at the moment.

kyllerss commented 11 months ago

Thanks for the clarification (perhaps a documentation update in the meantime?)

Lms24 commented 11 months ago

Our documentation already states that we don't support the netlify adapter out of the box. As for Netlify's documentation, they might want to update it in the meantime but I'd recommend opening an issue on their end. Thank you!

getsantry[bot] commented 4 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀