Skip to content

[Nuxt] Server-side not reporting any errors (GCP Cloud Build / Cloud Run) #17165

@azoom-julio-quiezi

Description

@azoom-julio-quiezi

Is there an existing issue for this?

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.

  1. 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.
  2. Intentionally remove the API from env files to get an error.
  3. 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).

Image

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

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions