Skip to content

fix(nextjs): Flush in route handlers #17223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025
Merged

fix(nextjs): Flush in route handlers #17223

merged 1 commit into from
Jul 30, 2025

Conversation

chargome
Copy link
Member

@chargome chargome commented Jul 30, 2025

closes https://linear.app/getsentry/issue/JS-783/nextjs-no-data-being-sent-from-server-side-functions
closes #17193

This will not fix this issue for prod deployments with turbopack as we do not have any build time instrumentation for route handlers there yet. In this case the current suggestion is to use:

import { after} from 'next/server';
import * as Sentry from '@sentry/nextjs';

export function GET() {
    after(() => {
        Sentry.flush();
    });
    // rest of your handler
}

@chargome chargome self-assigned this Jul 30, 2025
Copy link

linear bot commented Jul 30, 2025

@chargome chargome requested review from s1gr1d and RulaKhaled July 30, 2025 10:23
@chargome chargome enabled auto-merge (squash) July 30, 2025 10:27
@chargome chargome merged commit b9849a2 into develop Jul 30, 2025
61 checks passed
@chargome chargome deleted the cg-nextjs-after branch July 30, 2025 10:39
chargome added a commit that referenced this pull request Jul 31, 2025
chargome added a commit that referenced this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NextJS] No data being sent from server-side functions
2 participants