Repository navigation
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.40.0
Framework Version
3.17.7
Link to Sentry event
No response
Reproduction Example/SDK Setup
//nuxt.config.ts
export default defineNuxtConfig({
compatibilityDate: '2024-11-01',
devtools: { enabled: true },
// other stuff
modules: [
'@sentry/nuxt/module',
// other stuff
],
runtimeConfig: {
public: {
sentryDsn: '',
},
},
nitro: {
esbuild: {
options: {
target: 'es2022',
},
},
},
})// sentry.server.config.ts
import process from 'node:process'
import * as Sentry from '@sentry/nuxt'
Sentry.init({
dsn: process.env.NUXT_PUBLIC_SENTRY_DSN,
environment: process.env.APP_ENV,
_experiments: { enableLogs: true },
tracesSampleRate: 0.0,
debug: true,
})// sentry.client.config.ts
import * as Sentry from '@sentry/nuxt'
const config = useRuntimeConfig()
if (config.public.sentryDsn && config.public.sentryDsn !== '') {
Sentry.init({
dsn: config.public.sentryDsn,
environment: config.public.environment,
tracesSampleRate: 0.0,
})
} // capture example
Sentry.withScope((scope) => {
scope.setExtra('email-error', emailResult.error)
scope.setExtra('email-payload', {
from: '',
to: '',
subject: emailTemplate.subject,
service: '',
})
Sentry.captureMessage('Email sending failed in non-reporting API', 'error')
})Steps to Reproduce
We're experiencing an issue where Sentry notifications work perfectly in local development but fail to appear in our staging/production environment. Server-side Sentry events are not being captured or reported to the Sentry dashboard, however, client-side Sentry events are being captured or reported to the Sentry dashboard.
- Deploy the code using Cloud Build (GCP) and run using Cloud Run using Sentry.captureMessage as seen in the code snippet to capture messages from emails not sent.
- Intentionally remove the API from env files to get an error.
- Capture that error on Sentry Issues / Dashboard
Expected Result
I expected to capture the error in Sentry, but nothing appears on Dashboard.
Installed using pnpm.
What Works
✅ Local Development: Sentry captures all errors and sends notifications
✅ Client-side: Sentry works in both local and staging
✅ Configuration: Sentry is properly initialized (confirmed via debug logs)
✅ Environment Variables: DSN and environment are correctly set
What Doesn't Work
❌ Server-side in Staging: No Sentry notifications appear in dashboard
❌ Email failure events: Not captured in staging environment
Key Findings
Sentry Initialization: Confirmed working via server logs
Environment Variables: Properly set in staging
API Endpoints: Functioning correctly (return expected errors)
Server-side vs Client-side: Only server-side affected
Development vs Staging: Only staging environment affected
Event ID: When the error occurs, the event ID is shown, which means we are getting a response from Sentry (image below).
Actual Result
No server-side issues are seen in the Dashboard, despite having a response from Sentry with the Event ID when errors happen on staging environment (Cloud Build / Cloud Run).
But works fine on local machine.
Metadata
Metadata
Assignees
Projects
- StatusShow more project fieldsWaiting for: Product Owner
Activity
linear commentedon Jul 25, 2025
JS-772 [Nuxt] Server-side not reporting any errors (GCP Cloud Build / Cloud Run)
s1gr1d commentedon Jul 25, 2025
Hello, and thanks for the descriptive issue!
It could be that the serverless function runtime is not long enough to still send the event to Sentry. I added a PR that will also detect a Google Could Run runtime: #17168
Do you get other logs from Sentry as well?
feat(meta): Unify detection of serverless environments and add Cloud …
azoom-julio-quiezi commentedon Jul 28, 2025
@s1gr1d
Hello, thanks for the response.
I have not tried any other logs from Sentry, only Event ID.
By the way, the Event ID is generated on my system and then sent to Sentry? How does the the Event ID generation process work?
Also, what logs do you think would be helpful?
s1gr1d commentedon Jul 28, 2025
The event ID is usually generated by the SDK when an error occurs in
captureExceptionhere.When starting the server you should see logs like these below (shortened). Do you see those?
And on request:
feat(meta): Unify detection of serverless environments and add Cloud …
feat(v9/meta): Unify detection of serverless environments and add Clo…
s1gr1d commentedon Aug 4, 2025
Does it work when you upgrade to the latest version of the SDK?
azoom-julio-quiezi commentedon Aug 15, 2025
@s1gr1d
Hello, sorry for the late reply, I was working on another project.
Today I started working on this issue again and I could resolve it.
The issue was a combination of two factors:
import process from 'node:process'in sentry.server.config.tsFor some reason, adding
import process from 'node:process'causes it to be duplicated when the app tries to import server-side configuration, as seen in the log below extracted from Logging in GCP, finally causing a syntax error.After removing it, the issue was fixed.
At this point, I cannot tell if this a Sentry SDK issue or GCP Cloud Build issue.
s1gr1d commentedon Aug 19, 2025
Good to hear that it works for you now!
The import from process and
globalThis._importMeta_comes from Nitro. As process is already imported, you don't have to do it a second time.Does it work for you when you remove the process import? I'll close the issue now, but I can open it again if there's still an issue.
azoom-julio-quiezi commentedon Aug 19, 2025
Yes, it does work.
I think it is safe to close the issue, thank you!