Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Have a NextJS Server action that does a redirect inside withServerActionInstrumentation
e.g. this server action
async function serverAction() {
await withServerActionInstrumentation('serverAction', () => {
redirect('/foo');
});
}
Will be marked with a transaction in Sentry that had an "internal_error"
Runnable example (Claude generated, but human validated):
const Sentry = require('@sentry/nextjs');
const nav = require('next/navigation');
const transactions = [];
Sentry.init({
dsn: 'https://public@example.ingest.sentry.io/1',
tracesSampleRate: 1,
beforeSendTransaction(ev) {
transactions.push(ev);
return null;
},
});
async function run(name, body) {
try {
await Sentry.withServerActionInstrumentation(name, body);
} catch {}
}
(async () => {
await run('redirect', async () => {
nav.redirect('/login');
});
await run('not-found', async () => {
nav.notFound();
});
await run('success', async () => 'ok');
await run('genuine-error', async () => {
throw new Error('boom');
});
await Sentry.flush(2000);
for (const t of transactions) {
console.log(t.transaction, '=>', t.contexts?.trace?.status);
}
})();
// Output:
// serverAction/redirect => internal_error <-- wrong
// serverAction/not-found => not_found
// serverAction/success => ok
// serverAction/genuine-error => internal_error
Expected Result
Should have not been marked as internal_error
Actual Result
Product Area
Explore
Link
No response
DSN
https://b6d4dd5853e462b70bc0ca053c34e7dc@o4509326989918208.ingest.us.sentry.io/4509331771359232
Version
No response
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Have a NextJS Server action that does a redirect inside
withServerActionInstrumentatione.g. this server action
Will be marked with a transaction in Sentry that had an "internal_error"
Runnable example (Claude generated, but human validated):
Expected Result
Should have not been marked as internal_error
Actual Result
Product Area
Explore
Link
No response
DSN
https://b6d4dd5853e462b70bc0ca053c34e7dc@o4509326989918208.ingest.us.sentry.io/4509331771359232
Version
No response