-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find package '@sentry/sveltekit' when deploying on production on a monorepo #14565
Comments
Hey @fuuuzz thanks for writing in! Any chance that scalingo caches dependencies or something along these lines? I'm not aware of this error being reported before so not entirely sure if this is really an SDK-related problem (yet). |
Hello @Lms24 ! Thanks for reaching back 😃 Scalingo use something they call Following their documentation, I cleared the cache, but it had no effect. I also tried to deploy on a fresh instance, and still did not work. Do you see anything odd I implemented ? I might missed some trivial stuff 😅 Thanks again for your replies! |
Nothing out of the ordinary tbh! The config looks reasonable to me. On first glance I suspected that the SDK package was registered as in Given that it is the only dependency though, any chance something generally goes wrong with packages in The other angle would be the monorepo setup. I'd assume the package is hoisted into the monorepo's top level |
Not that I know tbh
So I went down this road after your suggestion 😅
I thought I had something but I got stuck at Here are the packages config, i guess only root package.json {
"name": "boris",
"version": "1.0.0",
"private": true,
"engines": {
"node": "20.18.0",
"npm": "10"
},
"workspaces": [
"client"
],
"scripts": {
"prepare": "husky"
},
"devDependencies": {
"@eslint/js": "^9.12.0",
"@types/eslint": "^9.6.0",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"lint-staged": "^15.2.5",
"prettier": "^3.1.1",
"typescript": "5.6.3",
"typescript-eslint": "^8.0.0"
},
"dependencies": {
"@opentelemetry/api": "1.9.0",
"@sentry/core": "8.41.0",
"@sentry/node": "8.41.0",
"@sentry/sveltekit": "8.41.0"
}
}
client/package.json {
"name": "@boris/client",
"version": "1.0.0",
"private": true,
"engines": {
"node": "20.18.0",
"npm": "10"
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
"start": "node build",
"preview": "vite preview",
"test": "npm run test:integration && npm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"test:e2e": "playwright test",
"test:unit": "vitest"
},
"devDependencies": {
"@csstools/postcss-global-data": "^3.0.0",
"@gouvfr/dsfr": "^1.12.1",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-node": "^5.2.9",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.6",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"husky": "^9.1.6",
"nanoid": "^5.0.8",
"papaparse": "^5.4.1",
"postcss": "^8.4.49",
"postcss-custom-media": "^11.0.5",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "5.1.12",
"svelte-check": "^4.0.0",
"vite": "^5.0.3",
"vitest": "^2.0.0"
},
"dependencies": {
"@opentelemetry/api": "1.9.0",
"@sentry/core": "^8.42.0",
"@sentry/node": "^8.42.0",
"@sentry/sveltekit": "^8.42.0"
},
"type": "module"
} Logs output from Scalingo 2024-12-04 16:49:17.884377796 +0100 CET [manager] container [web-1] (675079eb9982697789ee5f8f) started
2024-12-04 16:49:18.215231204 +0100 CET [web-1] > @boris/[email protected] start
2024-12-04 16:49:18.215242974 +0100 CET [web-1] > node build
2024-12-04 16:49:18.366217588 +0100 CET [web-1] '/app/node_modules/@sentry/sveltekit/build/cjs/server/index.js',
2024-12-04 16:49:18.366051825 +0100 CET [web-1] Require stack:
2024-12-04 16:49:18.366114777 +0100 CET [web-1] code: 'MODULE_NOT_FOUND',
2024-12-04 16:49:18.366053117 +0100 CET [web-1] - /app/node_modules/@sentry/node/build/cjs/index.js
2024-12-04 16:49:18.366218832 +0100 CET [web-1] ]
2024-12-04 16:49:18.366049391 +0100 CET [web-1] const err = new Error(message);
2024-12-04 16:49:18.366114408 +0100 CET [web-1] at Module.require (node:internal/modules/cjs/loader:1311:19) {
2024-12-04 16:49:18.366147526 +0100 CET [web-1] requireStack: [
2024-12-04 16:49:18.366219523 +0100 CET [web-1] Node.js v20.18.0
2024-12-04 16:49:18.366100398 +0100 CET [web-1] at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
2024-12-04 16:49:18.366098198 +0100 CET [web-1] at Module.require (node:internal/modules/cjs/loader:1311:19)
2024-12-04 16:49:18.366052342 +0100 CET [web-1] - /app/node_modules/@sentry/node/build/cjs/integrations/http/index.js
2024-12-04 16:49:18.366051268 +0100 CET [web-1] Error: Cannot find module '@opentelemetry/api'
2024-12-04 16:49:18.366099376 +0100 CET [web-1] at Object.<anonymous> (/app/node_modules/@sentry/node/build/cjs/integrations/http/index.js:7:13)
2024-12-04 16:49:18.366212131 +0100 CET [web-1] '/app/node_modules/@sentry/node/build/cjs/index.js',
2024-12-04 16:49:18.366053626 +0100 CET [web-1] - /app/node_modules/@sentry/sveltekit/build/cjs/server/index.js
2024-12-04 16:49:18.366101612 +0100 CET [web-1] at Module._load (node:internal/modules/cjs/loader:1104:12)
2024-12-04 16:49:18.366093833 +0100 CET [web-1] at Module._load (node:internal/modules/cjs/loader:1051:27)
2024-12-04 16:49:18.366035286 +0100 CET [web-1] node:internal/modules/cjs/loader:1225
2024-12-04 16:49:18.366218095 +0100 CET [web-1] '/app/node_modules/@sentry/sveltekit/build/cjs/index.server.js'
2024-12-04 16:49:18.366100761 +0100 CET [web-1] at Module.load (node:internal/modules/cjs/loader:1288:32)
2024-12-04 16:49:18.366050751 +0100 CET [web-1] ^
2024-12-04 16:49:18.366219150 +0100 CET [web-1] }
2024-12-04 16:49:18.366152151 +0100 CET [web-1] '/app/node_modules/@sentry/node/build/cjs/integrations/http/index.js',
2024-12-04 16:49:18.366054761 +0100 CET [web-1] at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
2024-12-04 16:49:18.366100030 +0100 CET [web-1] at Module._compile (node:internal/modules/cjs/loader:1469:14)
2024-12-04 16:49:18.366098792 +0100 CET [web-1] at require (node:internal/modules/helpers:179:18)
2024-12-04 16:49:18.366054422 +0100 CET [web-1] - /app/node_modules/@sentry/sveltekit/build/cjs/index.server.js (You can still see the repo if needed here) |
Reads like a "fun" experiment, thanks for still doing it! 😅 So this makes me think that it is indeed related to the hoisting of the dependency. Once you added one of the deps specifically to the node_modules of the application, it was found but now the next one in the dependency graph was missing. But this is weird again. Because I will check out your repo to see if it installs correctly on my system. Not sure if I can deploy to scalingo though. |
I actually had fun 😆
Again, i have no issue locally, it builds smoothly, which points to a certain issue with scalingo hoisting imo. Don't hesitate to fork the repo if you want to deploy it to your own scalingo instance. I can also open one for you and add you as a collaborator. What would be your strategy to dig in ? Thanks again for taking time to investigate! |
Just to confirm: You are using |
Yes! Good old |
Okay, I did some digging and I can repro that if you set a specific version for the I recommend raising this with Scalingo. My suspicion is that they don't handle npm workspace monorepo deploys correctly. Fwiw, this is the first time I'm hearing about this specific issue so I don't think it's related to the sveltekit SDK package specifically. Also sorry that we can't help you more on our end. |
Noted! I'll look into it with Scalingo. I'll reach back when I find a solution :) Thanks a lot for your time, really appriciate it 😁 |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/sveltekit
SDK Version
^8.42.0
Framework Version
^2.0.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
Hello!
I have a monorepo (link) with a SvelteKit client. When deploying my app to production,
node build
command fails because it can't find@sentry/sveltkit
module in server hooks chunks.My application is deployed on a Scalingo instance, and is using the
node-adapter
.I used
npx @sentry/wizard@latest -i sveltekit
to install Sentry."Unfortunately", it works well locally, I can't reproduce the error.
I also tried to install Sentry manually, but the result is the same.
Thanks in advance 😄 🙏
Steps to Reproduce
node build
command failsExpected Result
@sentry/sveltekit module should be found on SvelteKit's server hook during
node build
Actual Result
The text was updated successfully, but these errors were encountered: