LiRiK
LiRiK15mo ago

./node_modules/convex/src/server/router.ts error

Hello everyone, when trying to build an application with the npm run build command, this error comes out, I absolutely do not understand what this is related to and why this is so. If anyone knows what the problem might be, please tell me, if necessary, I can send other project files PS: when trying to execute the npx convex deploy --cmd 'npm run build' command, the result is the same
No description
50 Replies
erquhart
erquhart15mo ago
Have you made any edits to your convex/tsconfig.json? What do you have under compilerOptions.target
ballingt
ballingt15mo ago
Also curious about your non-Convex directory tsconfig.json
LiRiK
LiRiKOP15mo ago
I tried making changes to this file, but it didn't help.
No description
LiRiK
LiRiKOP15mo ago
No description
LiRiK
LiRiKOP15mo ago
Are you more comfortable with screenshots or is it better for me to send the code in text?
erquhart
erquhart15mo ago
This is fine. Nothing is jumping out at me as to why you'd be getting that type error. Still looking
LiRiK
LiRiKOP15mo ago
This is the complete output of the npm run build command
LiRiK
LiRiKOP15mo ago
Maybe this will help you figure it out?
ballingt
ballingt15mo ago
What version of TypeScript are you using?
erquhart
erquhart15mo ago
Something is happening not in line with your tsconfigs
LiRiK
LiRiKOP15mo ago
"typescript": "^5"
erquhart
erquhart15mo ago
Feels like a Next issue. Looking for precedents The error in your original post, is that on your local or in Vercel's deployment env
erquhart
erquhart15mo ago
GitHub
During next build, the "Checking validity of types" phase should ...
Goals During next build, the "Checking validity of types" phase should respect the typescript.tsconfigPath in next.config.js Non-Goals No response Background I maintain several tsconfig f...
LiRiK
LiRiKOP15mo ago
I tried to execute the command both locally and on the vercel platform I also use clerk for authorization, maybe the problem is related to this?
erquhart
erquhart15mo ago
Doubtful A stretch, but try deleting the next cache and rebuilding locally (delete .next folder)
LiRiK
LiRiKOP15mo ago
I changed this and the error with edge runtime disappeared.
No description
LiRiK
LiRiKOP15mo ago
And tell me, how to do this would be more correct, first run npm run dev or npx convex dev?
erquhart
erquhart15mo ago
hmm I would not have expected that to be case sensitive, but yeah that checks out
LiRiK
LiRiKOP15mo ago
I think the fact is that you have "ESNext" specified in the tsconfig in the convex, and I have "esnext" specified locally, I decided to change it and everything became normal)
erquhart
erquhart15mo ago
Guessing your npm dev script just runs the next server? I haven't built with convex and next so honestly not sure of the order - run npx convex dev first to be sure Likely doesn't matter, but might
LiRiK
LiRiKOP15mo ago
No description
LiRiK
LiRiKOP15mo ago
Ok, sec Haha, the error remained, but now the edge runtime error has returned again
erquhart
erquhart15mo ago
What did you change that led to the error disappearing, and what has changed since
LiRiK
LiRiKOP15mo ago
I changed the case of "esnext" to "ESNext", the error disappeared, then deleted the folder.next, started convex, started npm run dev, generated .next, I stopped both commands, started npm run build, the error returned
erquhart
erquhart15mo ago
Do the dev commands work?
LiRiK
LiRiKOP15mo ago
Absolutely, all pages, everything works, all the functionality (I wrote a board with liveblocks) which surprises me, absolutely everything works, except for the npm run build command
erquhart
erquhart15mo ago
Where did the dom.iterable entry come from in your root tsconfig Curious if dropping that could help
LiRiK
LiRiKOP15mo ago
I'm sorry, I don't understand what you're talking about
erquhart
erquhart15mo ago
In the tsconfig in your project root, compilerOptions.lib It includes ['dom', 'dom.iterable'] - I believe you should be able to drop dom.iterable since you're using esnext, although I'm not positive. I'm curious if it's causing the iterator error
LiRiK
LiRiKOP15mo ago
I deleted the VSC doesn't swear, I need to clean it up .next?
erquhart
erquhart15mo ago
Not sure what you mean in the first part of your sentence there It's very possible dom.iterable is required and this will break things even more lol It looks to not be included in esnext
LiRiK
LiRiKOP15mo ago
I deleted it, visual studio code will not give an error
erquhart
erquhart15mo ago
Error from deleting it would either be in next build or at runtime in the browser
ballingt
ballingt15mo ago
I don't see a target: "ESNext" in the tsconfig.json in your project root (not the one at convex/tsconfig.json). Next won't allow some changes to this file, but could you try adding target: "ES6"?
erquhart
erquhart15mo ago
oh good catch - and replace dom.iterable when you do, that was a reach
LiRiK
LiRiKOP15mo ago
No description
erquhart
erquhart15mo ago
Yeah put dom.iterable back, try Tom's suggestion compilerOptions.target: "ES6" in your root tsconfig
LiRiK
LiRiKOP15mo ago
I returned it but the error remained Haha
LiRiK
LiRiKOP15mo ago
No description
LiRiK
LiRiKOP15mo ago
Haha
erquhart
erquhart15mo ago
Seems like there are multiple typechecking phases using different targets - this error wasn't happening before, meaning the target was already higher than ES6 okay
LiRiK
LiRiKOP15mo ago
OMG
erquhart
erquhart15mo ago
drop target: "ES6" from your root tsconfig lol don't say it's working
LiRiK
LiRiKOP15mo ago
It works on ES2022 LoL
LiRiK
LiRiKOP15mo ago
No description
erquhart
erquhart15mo ago
that makes zero sense, the failure was due to being below ES2015 full build worked?
LiRiK
LiRiKOP15mo ago
To be honest, I do not know, but it seems like this is my first build of next
No description
LiRiK
LiRiKOP15mo ago
Well, it looks kind of normal.
erquhart
erquhart15mo ago
Hey, take the win It doesn't appear that setting the compiler target for next is discouraged anywhere, and in some places it's encouraged
LiRiK
LiRiKOP15mo ago
OK, thank you very much, good luck with the development of convex, I'm not a professional, but I think convex is very cool. Thanks again

Did you find this page helpful?