T
TanStack•6mo ago
quickest-silver

Error when building with getWebRequest() in loader

I have this error when run build:
"AsyncLocalStorage" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/vinxi@0.5.3_@types+node@22.13.10_db0@0.3.1_drizzle-orm@0.39.3_@neondatabase+serverless@0.10.4_cnofzffdinxbdcnzy4hyqutbei/node_modules/vinxi/runtime/http.js
"AsyncLocalStorage" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/vinxi@0.5.3_@types+node@22.13.10_db0@0.3.1_drizzle-orm@0.39.3_@neondatabase+serverless@0.10.4_cnofzffdinxbdcnzy4hyqutbei/node_modules/vinxi/runtime/http.js
When i run dev everything works fine
4 Replies
rare-sapphire
rare-sapphire•6mo ago
this is a server only function that needs to be executed inside a server function
quickest-silver
quickest-silverOP•6mo ago
So, loader function for createFileRoute is executed on client side?
rare-sapphire
rare-sapphire•6mo ago
it's executed on both. during SSR on the server, subsequent requests on the client
quickest-silver
quickest-silverOP•6mo ago
Oh ok, thanks. I move my code to createServerFn and i call this in loader function. Now i'ts working 🙂

Did you find this page helpful?