Python serverless function returns 404 in local, but fine in prod

I am following your doc to create a Python serverless function. It runs fine in production, but returns 404 in local (running vercel dev). Why is that?

My project structure:

app
api
|- hello.py
requirements.txt
vercel.json
// requirements.txt

venmo-api==0.3.1
// vercel.json

{
  "buildCommand": "npx convex deploy --cmd 'npm run build'",
  "installCommand": "npm install --legacy-peer-deps",
  "functions": {
    "api/**": {
      "excludeFiles": "{.next,*.cache,node_modules,public,app}/**"
    }
  }
}
// hello.py

from http.server import BaseHTTPRequestHandler
from venmo_api import Client

class handler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-type', 'text/plain')
        self.end_headers()
        self.wfile.write('Hello, world!'.encode('utf-8'))
        return

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

What is the Development Command for the project?

vercel dev. I mentioned it in the question.

Sorry, I wasn’t clear about what I meant. Projects can have a custom Development Command defined. Does your project have a development command specified?

No, here’s my package.json:

{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  ...
}

My vercel.json is in the original question.