You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import*asSentryfrom'@sentry/nuxt';Sentry.init({dsn: '***',// TODO: We recommend adjusting this value in production, or using tracesSampler// for finer controltracesSampleRate: 1.0,// Setting this option to true will print useful information to the console while you're setting up Sentry.debug: false});
Steps to Reproduce
When using @sentry/nuxt in a backend-only Nuxt project (e.g., an API without a frontend), Sentry does not automatically capture errors, and even manual error capture (Sentry.captureException(error)) does not work.
It seems that Sentry only initializes when the frontend is engaged. The following logs appear when the frontend is accessed:
ℹ ✨ new dependencies optimized: @sentry/nuxt
ℹ ✨ optimized dependencies changed. reloading
However, if there is no frontend interaction, Sentry does not seem to start, and no errors are captured in the backend.
Steps to Reproduce
Create a Nuxt project with a backend-only API (server/api/ handlers).
Trigger an error in an API route.
Observe that no errors are reported to Sentry.
Expected Result
Sentry should initialize and capture errors automatically, even in an API backend-only Nuxt setup.
Manual error capture (Sentry.captureException(error)) should work as expected.
Actual Result
Sentry is not capturing exceptions in an API backend-only Nuxt setup. Even manual error capture (Sentry.captureException(error)) is not working as expected.
The text was updated successfully, but these errors were encountered:
I tried reproducing this locally by creating a new nuxt project via the nuxi wizard and setting up sentry using sentry-wizard. I removed the frontend routes and any .vue files, started the server using node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs and sent a request to /api/sentry-example-api which is set up by the wizard and looks like this:
// This is just a very simple API route that throws an example error.// Feel free to delete this file.import{defineEventHandler}from'#imports';exportdefaultdefineEventHandler(()=>{thrownewError("Sentry Example API Route Error");});
And the error shows up:
Could you please set debug: true in sentry.server.config.ts and paste some startup logs and logs after you fire off a request?
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
v9
Framework Version
Nuxt 3.15.1 + Node v22 + pnpm@9.15.4
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
When using @sentry/nuxt in a backend-only Nuxt project (e.g., an API without a frontend), Sentry does not automatically capture errors, and even manual error capture (Sentry.captureException(error)) does not work.
It seems that Sentry only initializes when the frontend is engaged. The following logs appear when the frontend is accessed:
ℹ ✨ new dependencies optimized: @sentry/nuxt
ℹ ✨ optimized dependencies changed. reloading
However, if there is no frontend interaction, Sentry does not seem to start, and no errors are captured in the backend.
Steps to Reproduce
Expected Result
Sentry should initialize and capture errors automatically, even in an API backend-only Nuxt setup.
Manual error capture (Sentry.captureException(error)) should work as expected.
Actual Result
Sentry is not capturing exceptions in an API backend-only Nuxt setup. Even manual error capture (Sentry.captureException(error)) is not working as expected.
The text was updated successfully, but these errors were encountered: