When copying the sample code from https://orpc.unnoq.com/docs/adapters/next#next-js-adapter, I encountered a type error. The context requires a header with the type nodejs IncomingRequestHeader.
async function handleRequest(request: Request) {
const { response } = await handler.handle(request, {
prefix: '/rpc',
context: {
// type error
},
})
return response ?? new Response('Not found', { status: 404 })
}
I have two questions for clarification:
- Since we're using the web standard API, could you explain why there's a Node.js-specific header requirement?
- The first argument of
handle is already a request object—could you clarify why the header needs to be passed again in the context?
Would appreciate any guidance on resolving this or adjusting the example for better alignment with web standards. Thanks!
When copying the sample code from https://orpc.unnoq.com/docs/adapters/next#next-js-adapter, I encountered a type error. The
contextrequires a header with the typenodejs IncomingRequestHeader.I have two questions for clarification:
handleis already arequestobject—could you clarify why the header needs to be passed again in thecontext?Would appreciate any guidance on resolving this or adjusting the example for better alignment with web standards. Thanks!