-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
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.1.0
Framework Version
Nuxt 3.15.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
Those files were created using the commands in steps:
sentry.client.config.ts
import * as Sentry from "@sentry/nuxt";
Sentry.init({
// If set up, you can use your runtime config here
// dsn: useRuntimeConfig().public.sentry.dsn,
dsn: "https://REDACTED",
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
// If you don't want to use Session Replay, just remove the line below:
integrations: [Sentry.replayIntegration()],
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
sentry.server.config.ts
import * as Sentry from "@sentry/nuxt";
Sentry.init({
dsn: "https://REDACTED",
// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});
nuxt.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2024-11-01',
devtools: { enabled: true },
modules: ['@sentry/nuxt/module'],
sentry: {
sourceMapsUploadOptions: {
org: 'REDACTED',
project: 'nuxt-test'
}
},
sourcemap: {
client: 'hidden'
}
})
package.json
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@sentry/nuxt": "^9.1.0",
"import-in-the-middle": "^1.13.0",
"nuxt": "^3.15.4",
"vue": "latest",
"vue-router": "latest"
},
"packageManager": "[email protected]+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a"
}
Steps to Reproduce
- Use Node 22 with pnpm
- Create a new Nuxt project using
pnpm dlx nuxi@latest init test cd testpnpm i- Setup Sentry using
npx @sentry/wizard@latest -i nuxt --saas --org REDACTED --project nuxt-test pnpm ipnpm run buildnode --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
We reproduced this on two different machines (MacOS)
Expected Result
The built Nuxt application will run with imported Sentry server config
Actual Result
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs
file:///REDACTED/test/.output/server/sentry.server.config.mjs:9122
if (require.resolve && require.resolve.paths) {
^
ReferenceError: require is not defined in ES module scope, you can use import instead
at requireRequireInTheMiddle (file:///REDACTED/test/.output/server/sentry.server.config.mjs:9122:3)
at file:///REDACTED/test/output/server/sentry.server.config.mjs:9333:33
at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:111:9)
Node.js v22.14.0
CoconutTheSlayer
Metadata
Metadata
Assignees
Labels
Projects
Status
No status