casado
casado9mo ago

Wrong node version with local convex

I'm probably doing something stupid here, but I've been stuck on this for a couple of days. When using AI town and running the local server, the convex backend is unable to connect. The server client side and server side errors are attached. The server error is:
2024-04-30T22:33:50.727635Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): Hit an error while pushing:
Wrong node version v21.7.3
installed at node: Wrong node version v21.7.3
installed at node
2024-04-30T22:33:50.727635Z ERROR common::errors: Caught error (RUST_BACKTRACE=1 RUST_LOG=info,common::errors=debug for full trace): Hit an error while pushing:
Wrong node version v21.7.3
installed at node: Wrong node version v21.7.3
installed at node
I've tried to use nvm us with 18,19 and 20 to see if that fixes it but I get the same error. The client side command is:
just convex dev
cd /Users/martin/projects/local-ai-town/ai-town; npx convex "$@" --admin-key XXX --url "http://127.0.0.1:3210"
just convex dev
cd /Users/martin/projects/local-ai-town/ai-town; npx convex "$@" --admin-key XXX --url "http://127.0.0.1:3210"
. I've tried multiple fresh checkouts and it persists. Any thoughts?
No description
No description
7 Replies
ian
ian9mo ago
Have you done the nvm use 18 in the shell where you're running ./convex-local-backend and where you're running just convex dev or just in one of them?
casado
casadoOP9mo ago
I believe both but let me verify Ah. that worked! Thank you! I can add this to the readme. Should we recommend 18? I think the issue might be that I was running the local convex in a separate directory
ian
ian9mo ago
fwiw I couldn't repro this using node 21 on both (in the same directory)
casado
casadoOP9mo ago
ok that must be it. I can just add a caution that they need to be in the same directory. thanks @ian !
cocktailpeanut
cocktailpeanut9mo ago
I ran into his issue too and found that the code has node@18 hardcoded. Unless I'm missing something, the code literally has the check logic for the pattern v18. hardcoded, so any other node version than v18 would fail. I had to get around this issue by creating a dedicated conda environment that installs node v18, which is inefficient. Maybe there was a reason why it's pinned to v18, but if not, would be good to get rid of the restriction and instead say something like "the version is greater than or equalt to 18" Here's the hardcoded part https://github.com/get-convex/convex-backend/blob/99ad0fe0520633af9f8c1a4e7634d0d1a938e51c/crates/node_executor/src/local.rs#L88-L94
GitHub
convex-backend/crates/node_executor/src/local.rs at 99ad0fe0520633a...
Open source single-machine version of the Convex backend - get-convex/convex-backend
ballingt
ballingt9mo ago
Since "use node" code in Convex currently uses Node.js 18 in AWS Lambda, the local runner is hardcoded to copy this. When upgrade to Node.js 20 in Lambda or potentially allow multiple versions (which would be configured in the Convex code) the runner will need to match this version, or have whichever version the code uses installed.
casado
casadoOP9mo ago
Minimally we need to update the README in AI town to reflect this. I just merged a PR to add this to the README.

Did you find this page helpful?