I have a nextjs project. I had 2 serverless functions with a nodejs runtime, and had no problems. I now want to add a serverless function with a python runtime, and running into some issues. I am using the example code given here: https://vercel.com/docs/functions/runtimes/python
On local dev, when I do vercel dev, I can access the 2 nodejs functions. But I am unable to access the python function, getting a 404:
404: NOT_FOUNDCode: NOT_FOUNDTried switching it to index.py, having it in a folder vs not, etc. but doesn't work.
Once I deploy, if I have the python function present, I get:
Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB. : https://vercel.link/serverless-function-sizeI've tried removing and adding it, and it only happens when the python function is there, with nothing else changed. The function is simply the one given in the example, so very small/simple:
from http.server import BaseHTTPRequestHandler 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')) returnHere is my file structure:
.next/api/ hello/ route.ts indexTest/ indexTest.py newFile/ route.tsapp/components/lib/node_modules/.eslintrc.json.gitignore.vercelignorecomponents.jsonnext-env.d.tsnext.config.jspackage.jsonpostcss.config.jsREADME.mdtailwind.config.tstestHugging.pytsconfig.jsontsconfig.tsbuildinfovercel.jsonyarn.lockNote: The api folder was initially in the app folder, but moved it outside after running into this issue. Both don't work.
Things I've tried: Add a .vercelignore with:
node_modules .next .git *.logCreating vercel.json with:
{ "functions": { "api/indexTest/indexTest.py": { "memory": 1024, "maxDuration": 30 } }}Moving the function, renaming it, etc.
I do have my repo in a parent folder, with the folder I gave above under it, but don't think that should be a problem, everything else was working with that. I have my 'Root Directory' set to the subfolder. The larger folder only contains:
- The folder I gave above
- .git
- .vercel
- .gitignore
Would appreciate any/all help! Thanks