T
TanStack2mo ago
generous-apricot

`node` property not available on event param in defineEventHandler

Using the latest version of TanStack Start (1.125.3), I am trying to work with the event from defineEventHandler, but there is no node property available, only request (while the H3Event<EventHandlerRequest> type has node defined as property), this looks like a bug or there seems to be a type mismatch. Does anyone know what happened?
9 Replies
generous-apricot
generous-apricotOP2mo ago
Hey @Manuel Schiller , do you happen to know why this doesn't work anymore?
conscious-sapphire
conscious-sapphire2mo ago
i assume this is in dev? we dont use nitro in dev anymore
generous-apricot
generous-apricotOP2mo ago
yes this is in dev, but how is that related? I was just following this example setup for Lingui JS (https://github.com/lingui/js-lingui/blob/main/examples/tanstack-start/src/ssr.tsx) but this doesn't work anymore with the latest updates of tanstack start. Is defineEventHandler still the recommended approach to provide a custom handler?
GitHub
js-lingui/examples/tanstack-start/src/ssr.tsx at main · lingui/js-...
🌍 📖 A readable, automated, and optimized (2 kb) internationalization for JavaScript - lingui/js-lingui
generous-apricot
generous-apricotOP2mo ago
happy to provide more details but basically the event inside defineEventHandler doesn't have the node property anymore which basically breaks toWebRequest as it expects that.
conscious-sapphire
conscious-sapphire2mo ago
but how is that related?
as I wrote above, nitro is not used in the dev server anymore
Is defineEventHandler still the recommended approach to provide a custom handler?
no
conscious-sapphire
conscious-sapphire2mo ago
GitHub
router/e2e/react-start/basic/src/server.ts at main · TanStack/router
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router
generous-apricot
generous-apricotOP2mo ago
Okay got it, thanks! Maybe this should be deleted from the docs then? https://tanstack.com/start/latest/docs/framework/react/server-routes#handling-server-route-requests
Server Routes | TanStack Start React Docs
// TODO: Add redirect from api-routes to server-routes Server routes are a powerful feature of TanStack Start that allow you to create server-side endpoints in your application and are useful for hand...
generous-apricot
generous-apricotOP2mo ago
btw what is then the recommended way to set the headers for all requests? in the beforeload of the root route? Basically need to call this https://github.com/lingui/js-lingui/blob/main/examples/tanstack-start/src/ssr.tsx#L14
GitHub
js-lingui/examples/tanstack-start/src/ssr.tsx at main · lingui/js-...
🌍 📖 A readable, automated, and optimized (2 kb) internationalization for JavaScript - lingui/js-lingui
generous-apricot
generous-apricotOP2mo ago
and im planning to update the lingui docs too

Did you find this page helpful?