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/nuxt
SDK Version
9.23.0
Framework Version
3.17.4
Link to Sentry event
No response
Reproduction Example/SDK Setup
https://stackblitz.com/edit/nuxt-sentry-bundler-5xwxtezq?file=package.json
Steps to Reproduce
- Install 9.23.0 @sentry/nuxt
- Build application
- Either:
- Move the application to another folder OR
- Delete node_modules to simulate a production environment
- Run application with server include (
--import dist/server/sentry.server.config.mjs
)
Expected Result
Application to run as normal
> node --import ./dist/server/sentry.server.config.mjs ./dist/server/index.mjs
Listening on http://[::]:3000
Actual Result
The @sentry/nuxt
is no longer included in the build, causing the import in sentry.server.config.mjs
to fail
❯ ls -la /app/dist/server/node_modules/@sentry/
total 1
drwxrwxr-x 1 staff staff 3 May 29 17:00 ./
drwxrwxr-x 1 staff staff 32 May 29 17:00 ../
drwxrwxr-x 1 staff staff 2 May 29 17:00 core/
drwxrwxr-x 1 staff staff 3 May 29 17:00 node/
drwxrwxr-x 1 staff staff 3 May 29 17:00 opentelemetry/
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@sentry/nuxt' imported from /app/dist/server/sentry.server.config.mjs
at packageResolve (node:internal/modules/esm/resolve:161:9233)
at moduleResolve (node:internal/modules/esm/resolve:161:9926)
at defaultResolve (node:internal/modules/esm/resolve:161:12052)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:157:5815)
at #n (node:internal/modules/esm/loader:157:5397)
at ModuleLoader.resolve (node:internal/modules/esm/loader:157:5293)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:157:1852)
at ModuleJob._link (node:internal/modules/esm/module_job:158:1632) {
code: 'ERR_MODULE_NOT_FOUND'
}
This was caused by #16407. If the server is run from the dev directory, when node canot find /app/dist/server/node_modules/@sentry/nuxt
, it looks up the tree and finds /app/node_modules/@sentry/nuxt
. However, if you deploy only the dist
directly, for example in a multi-stage docker build, the application will no longer run.
Metadata
Metadata
Assignees
Type
Projects
Status
No status