-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Copy link
Labels
Description
Which project does this relate to?
Start
Describe the bug
When using a request middleware in a server function, the request
parameter passed to it is undefined while getRequest()
correctly returns it:
const requestMiddleware = createMiddleware({ type: "request" }).server(
async ({ next, request }) => {
return next({
context: {
requestParam: request?.url, <-- request is undefined
requestFunc: getRequest().url,
},
});
}
);
const serverFn = createServerFn()
.middleware([requestMiddleware])
.handler(async ({ context: { requestParam, requestFunc } }) => {
return { requestParam, requestFunc };
});
Your Example Website or App
https://codesandbox.io/p/devbox/composed-middleware-typing-issue-1-132-7-forked-zkxl87
Steps to Reproduce the Bug or Issue
- Click reproduction url
- Observe
requestParam
is undefined
Expected behavior
I expect the request
param passed to a middleware to be equal to getRequest
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.132.41
- Bundler: Vite
- Bundler Version: 7.1.9
Additional context
No response