Vercel Next.js: Function Runtimes Must Have Valid Version Error

Hi Vercel Community,

I’m encountering a very stubborn deployment error on my Next.js project (Hedonite/studio) and have exhausted all standard troubleshooting steps. I’m hoping someone here might have encountered something similar or can offer a fresh perspective.

The Problem: My deployments consistently fail with the exact same error message during the build process: Error: Function Runtimes must have a valid version, for example 'now-php@1.0.0'.

This happens reliably on every deployment, even after forcing cache skips. The Vercel build machine runs in Washington, D.C. (iad1).

Project Details:

  • Project Name: Hedonite/studio
  • Latest Failed Deployment ID: ce1b02b
  • (Please also refer to previous failed deployment IDs: 2328872)

Current Behaviour:

  • Deployments fail consistently during the “Running vercel build” step.
  • The error message is always “Function Runtimes must have a valid version, for example now-php@1.0.0.”
  • The build logs indicate Skipping build cache, deployment was triggered without cache.
  • The logs also state Removed 0 ignored files defined in .vercelignore, even with an aggressive .vercelignore strategy.

Expected Behaviour:

  • The project should build successfully, detecting and utilising the nodejs20.x runtime specified in my configuration for serverless functions.
  • The deployment should complete without errors, making the application accessible.

Troubleshooting Steps Taken (with relevant code/logs):

I’ve performed a comprehensive set of diagnostic and corrective actions:

  1. package.json Node.js Engine:
  • Action: Ensured package.json explicitly sets Node.js version to a supported LTS.
  • Relevant package.json snippet:JSON{ "name": "myapp", "version": "0.1.0", "private": true, "engines": { "node": "20.x" }, // ... rest of package.json }
  • Result: This configuration appears correct and aligns with Vercel recommendations.
  1. vercel.json Configuration:
  • Action: Removed invalid projectSettings and name properties to ensure schema validity. Explicitly set runtime for API routes.
  • Current vercel.json content:JSON{ "buildCommand": "npm run build", "outputDirectory": ".next", "devCommand": "npm run dev", "installCommand": "npm install", "framework": "nextjs", "regions": ["lhr1"], "env": { "NEXT_PUBLIC_APP_URL": "https://myapp.co.uk" }, "functions": { "src/app/api/**/*.js": { "runtime": "nodejs20.x", "maxDuration": 10 }, "src/app/api/**/*.ts": { "runtime": "nodejs20.x", "maxDuration": 10 } }, "headers": [ { "source": "/(.*)", "headers": [ { "key": "X-Content-Type-Options", "value": "nosniff" }, { "key": "X-Frame-Options", "value": "DENY" }, { "key": "X-XSS-Protection", "value": "1; mode=block" }, { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }, { "key": "Permissions-Policy", "value": "camera=(), microphone=(), geolocation=()" } ] }, { "source": "/api/(.*)", "headers": [ { "key": "Cache-Control", "value": "s-maxage=0" } ] }, { "source": "/_next/static/(.*)", "headers": [ { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" } ] } ], "rewrites": [ { "source": "/api/(.*)", "destination": "/api/$1" } ] }
  • Result: vercel.json is syntactically valid and includes correct runtime settings for functions.
  1. .vercelignore for Stray Files:
  • Action: Implemented an aggressive .vercelignore to exclude virtually all non-essential files from the build.
  • Current .vercelignore content:* !.vercelignore !package.json !package-lock.json !yarn.lock !pnpm-lock.yaml !next.config.js !tsconfig.json !README.md !public/** !src/app/**
  • Result: Build logs indicate Removed 0 ignored files defined in .vercelignore, suggesting no stray files outside of src/app are being processed.
  1. Cache Bypassing:
  • Action: All deployments were manually triggered with the “Deploy without cache” option.
  • Result: Build logs confirm Skipping build cache, deployment was triggered without cache., showing the latest configuration was used.

Full Log of Latest Failed Deployment:

[13:23:12.041] Running build in Washington, D.C., USA (East) – iad1 [13:23:12.042] Build machine configuration: 2 cores, 8 GB [13:23:12.059] Cloning github.com/Hedonite/studio (Branch: master, Commit: ce1b02b) [13:23:12.317] Previous build caches not available [13:23:12.644] Cloning completed: 585.000ms [13:23:12.698] Found .vercelignore [13:23:12.700] Removed 0 ignored files defined in .vercelignore [13:23:13.017] Running "vercel build" [13:23:13.454] Vercel CLI 43.3.0 [13:23:13.621] Error: Function Runtimes must have a valid version, for example now-php@1.0.0. [13:23:13.862] [13:23:16.344] Exiting build container

Request for Assistance:

Given the exhaustive troubleshooting and seemingly correct configurations, I am at a loss as to why this specific runtime error persists. My current assumption is that it might be an internal Vercel issue related to function runtime detection or an obscure internal cache problem that my cache-skipping doesn’t resolve.

Has anyone encountered this specific behaviour, especially with the “Removed 0 ignored files” log line alongside the runtime error? Any suggestions or insights would be incredibly helpful.

Thank you for your time and expertise.

Hi, Can you temporarily share the project using gitHub so we can take a look?

The runtime you’re specifying is invalid vercel/node@20.x

This should build if you just remove that, since it’ll pick up your config from engines instead