Spawn EBADF when running handling local request in dev server

Node v20.16.0
Vercel v37.14.0
Macbook Air M2
Running a function using the vercel-rust runtime.

  1. I start the server locally with npx vercel dev.
  2. I make a request which resolves to my rust api
  3. spawn EBADF
> Building vercel-rust@4.0.7:api/search.rs
Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:761:9)
    at fork (node:child_process:172:10)
    at createBuildProcess (/Users/mike/.npm/_npx/69f9afb961c37556/node_modules/vercel/dist/index.js:139797:55)
    at executeBuild (/Users/mike/.npm/_npx/69f9afb961c37556/node_modules/vercel/dist/index.js:139839:26)
    at DevServer.triggerBuild (/Users/mike/.npm/_npx/69f9afb961c37556/node_modules/vercel/dist/index.js:142225:26)
    at DevServer.serveProjectAsNowV2 (/Users/mike/.npm/_npx/69f9afb961c37556/node_modules/vercel/dist/index.js:141287:24)
    at async DevServer.devServerHandler (/Users/mike/.npm/_npx/69f9afb961c37556/node_modules/vercel/dist/index.js:140777:13) {
  errno: -9,
  code: 'EBADF',
  syscall: 'spawn'
}

Yesterday this worked.

There seem to be some bug reports on other projects about this at the moment, this one suggests that v4 of chokidar causes a problem on Macs : EBADF error with Nuxt 3 and Vite on macOS, requiring esbuild version override · Issue #29744 · nuxt/nuxt · GitHub

Deployment URL or Custom Domain:
Environment (local, preview, production): local
Project Framework: rust
Build Settings:
  Framework Preset:
  Build Command (if not default):
  Output Directory (if not default): public
  Install Command (if not default):
Node/Runtime Version: v20.16.0
Package Manager: npm
Relevant Packages:

Hi, @platy!

I took a look at the GitHub issue and it looks like it has been fixed. Are you still seeing issues?

Hi @pawlean

It actually wasn’t related to that issue at all, but there’s no information to go on to understand these EBADF errors so I was searching for something.

I have now found the issue, I had a new build target directory in my repo which wasn’t in my .vercelignore file. It has thousands of build files which the dev server was trying to watch. So that’s an easy fix.

It would be helpful if the cli had a limit for the number of files it would watch to avoid hitting EBADF and offer a more helpful error.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.