Hello Vercel Community,
I’m consistently getting the error Error: Function Runtimes must have a valid version, for example \now-php@1.0.0`.despite myvercel.jsonbeing configured withversion: 2and a valid Node.js runtime (e.g.,nodejs18.x`).
Issue:
My local vercel -d logs consistently show that when a deployment is created, Vercel’s API responds with "config":{"version":1} in the deployment details, even though my vercel.json clearly specifies "version": 2 causing the runtime definition to be rejected.
What I’ve Tried (All Resulted in the Same Error):
-
Original Project (
frontend-quiz-app-main):vercel.json:
(This project’s{ "version": 2, "functions": { "api/**/*.js": { "runtime": "nodejs18.x" } } }vercel.jsonwas also tested withnodejs20.xwith the same error results).api/gemini-chat.js:
(This function is for a Gemini chatbot API).export const config = { runtime: 'nodejs18' };- Vercel Dashboard Node.js Version (Build Environment): Set to
18.x(also tried20.xwhenvercel.jsonwasnodejs20.x). - Failed Deployment Inspect URL:
https://vercel.com/jay-laycos-projects/frontend-quiz-app-main/Cyo25teCvZdW7kS7j3mn3VYyEa9d?filter=errors - (Project ID:
prj_ws12Su6Z5bCQCmIC7AVrT8rRhLnF, Team:Jay Layco's projects-team_K4IsiEAa1G2LBBRbqwgM4iiW)
-
New Minimal Test Project (
gemini-api-test): Created to isolate the issue with identical settings and simplified code.vercel.jsonandapi/gemini-chat.jsconfigured as above fornodejs18.x.package.json:{"dependencies": { "@google/generative-ai": "^0.14.1" }}- Vercel Dashboard Node.js Version (Build Environment): Set to
18.x. - Outcome: Same error, and local CLI logs again showed Vercel’s API responding with
"config":{"version":1}. - Failed Deployment Inspect URL:
https://vercel.com/jay-laycos-projects/gemini-api-test/8ywS9NVLuuEx12UhpweXZAoaJPMq?filter=errors - (Project ID:
prj_2vGhatZNfW689tmCtEkbX8gvYL3F)
It seems like my projects are being forced into a V1 configuration context by Vercel’s backend, making valid V2 runtime definitions fail.
Has anyone encountered this behavior where version: 2 in vercel.json isn’t fully respected, leading to this runtime error? Any suggestions would be highly appreciated.
Thank you!