Skip to content
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
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@orpc/shared": "workspace:*"
},
"devDependencies": {
"next": "16.2.9",
"next": "^16.2.10",
"react": "^19.2.7"
}
}
12 changes: 3 additions & 9 deletions packages/next/src/server-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { AnyORPCError, AnyORPCErrorJSON, AnySchema, Context, ErrorMap, Infe
import type { MaybeOptionalOptions } from '@orpc/shared'
import { createProcedureClient, toORPCError } from '@orpc/server'
import { resolveMaybeOptionalOptions } from '@orpc/shared'
import { unstable_rethrow } from 'next/navigation'

export type ServerFunctionORPCErrorJSON<T>
= T extends ORPCError<infer U, infer V>
Expand Down Expand Up @@ -67,15 +68,8 @@ export function createServerFunction<
return [null, await client(input as any)]
}
catch (error) {
// special next.js errors
if (
error instanceof Error
&& 'digest' in error
&& typeof error.digest === 'string'
&& error.digest.startsWith('NEXT_')
) {
throw error
}
// https://nextjs.org/docs/app/api-reference/functions/unstable_rethrow
unstable_rethrow(error)

return [
toORPCError(error).toJSON() as ServerFunctionORPCErrorJSON<ORPCErrorFromErrorMap<TErrorMap> | TReturnedError | ThrowableError>,
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/react": "^19.2.17",
"@types/react-dom": "^19.2.3",
"@vercel/otel": "^2.1.3",
"next": "16.2.9",
"next": "^16.2.10",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"server-only": "^0.0.1",
Expand Down
94 changes: 47 additions & 47 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.