[Build] tanstack-start-injected-head-scriptRollup failed to resolve import "tanstack-start-injected-
Trying to build my project.
Getting;
No idea what cause that..
Using orpc, using getRequestHeaders in my server functions..
no idea.
26 Replies
jolly-crimson•2mo ago
Same issue, how did you fix it?
genetic-orange•2mo ago
if you're importing
getRequestHeaders from @tanstack/start-server-core, just don't
that's how i fixed it at leastextended-salmonOP•2mo ago
That was my idea too. But my app was too big. Just switched to next. I will use tan stack when it’s more stable
jolly-crimson•2mo ago
I am not importing
getRequestHeaders anywhere in my app, what can be the issue?adverse-sapphire•2mo ago
I know this issue happens if you try to call "getRequestHeaders()" in a beforeLoad for example
i assume it can happen with any function in @tanstack/react-start/server
and i think it's logic cause those functions should be called only in server functions ?
that's the issue ?
look at any place you use a function from @tanstack/react-start/server
@fstodulski
extended-salmonOP•2mo ago
Already migrated back to nextjs
adverse-sapphire•2mo ago
noooooo
extended-salmonOP•2mo ago
I spend 3 days on it. No idea where the issue was. I got different build issues - even on clean fresh projects - from TStack and Better Stack - even examples… will be back on it when it’s ready - is super dope project - definitely will use it someday
optimistic-gold•2mo ago
please provide a full project
optimistic-gold•2mo ago
could you be more specific on this wrong use please? i'm getting this error in my project after migrating from next.js. and i'm using
getRequestHeaders() but not using any beforeLoad in my repo. i'm not sure what's wrongoptimistic-gold•2mo ago

adverse-sapphire•2mo ago
in which place you use it ?
optimistic-gold•2mo ago
i'm using it in two places:
1.
then in my route file, i import this function and consume in the
loader
2. i followed the orpc guide on set up the client https://orpc.unnoq.com/docs/adapters/tanstack-start#optimize-ssradverse-sapphire•2mo ago
yep thats's the issue, you should use a "getRequestHeaders()" ONLY in server functions so via "createServerFn" or via "createIsomorphicFn"

adverse-sapphire•2mo ago
that's how i do it
and then i use this function with tanstack query
optimistic-gold•2mo ago
ah i see. so my first usage is causing issue. i should refer to the orpc doc's
createIsomorphicFn usage
thanks! i'll try change thatrival-black•2mo ago
can someone please help me with this error
https://discord.com/channels/719702312431386674/1431290268589752439
optimistic-gold•2mo ago
sadly i'm still seeing this issue.
for my point 1). i've replace all my
getUserFn to what looks like in your screenshot. 🙁
i wish the error prompt could be better
adverse-sapphire•2mo ago
maybe you are still using any other function that comes from "@tanstack/react-start/server" in the wrong way
oh wait, can you show your client.ts ?
optimistic-gold•2mo ago
omg nice catch. i found i'm using:
as well. after changing it into
createIsomorphicFn, now everything works!
thank you so much!!!!adverse-sapphire•2mo ago
nice !
optimistic-gold•2mo ago
there are still some other issues though. but this error is gone! i'll continue the migration 😄
❤️
rival-black•2mo ago
👋
extended-salmonOP•2mo ago
Hey @sirca How do you use it in your components?
adverse-sapphire•2mo ago
use what, the auth example i sent ?
frozen-sapphire•2w ago
Hi guys I am also getting this error, I have read this thread but I am not able to fix it.
I use better auth, I have a Pathless Layout Component _app.tsx where I have a beforeLoad where I call 'authWithOrgStateFn' isomorphicFn which is something similar to @sirca its example, other then that I have some serverFn which I consume in my components using useServerFn with Tanstack Query.
How can I trace the cause? Does someone have an idea?