Skip to content
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

Don't filter out <anonymous> source location frames through RSC #71752

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/next/src/client/app-find-source-map-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const pathname = `${basePath}/__nextjs_source-map`
export const findSourceMapURL =
process.env.NODE_ENV === 'development'
? function findSourceMapURL(filename: string): string | null {
if (filename === '') {
return null
}

const url = new URL(pathname, document.location.origin)

url.searchParams.set(
Expand Down
6 changes: 6 additions & 0 deletions packages/next/src/server/app-render/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,12 @@ async function renderToStream(
onError: serverComponentsErrorHandler,
environmentName: () =>
requestStore.prerenderPhase === true ? 'Prerender' : 'Server',
filterStackFrame(url: string, _functionName: string): boolean {
// The default implementation filters out <anonymous> stack frames
// but we want to retain them because current Server Components and
// built-in Components in parent stacks don't have source location.
return !url.startsWith('node:') && !url.includes('node_modules')
},
}
)
},
Expand Down
Loading