Python Example Issue
Hello,
I've been trying to use the python api example code and am experiencing some weird behavior. When I use the provided deploy button and deploy it as a new project to my account everything works as expected. When I copy the code into a project that I have already created (with other development branches and domains attached) and run vercel to deploy it I get the following error:
Error: No Next.js version could be detected in your project. Make sure `"next"` is installed in "dependencies" or "devDependencies"
Error: Check your logs at ...
From what I found, that is because I need to add the "builds": [{ "src": "./api/index.py", "use": "@vercel/python" }] line to my vercel.json file. When I do that, it allows the vercel build command to complete properly. Once that completes, I go to the preview link that the vercel command spits out but I get another error:
This Serverless Function has crashed.
Your connection is working correctly.
Vercel is working correctly.
500: INTERNAL_SERVER_ERROR
Code: FUNCTION_INVOCATION_FAILED
ID: ...
I followed the logs link to see what errors came up and it seems like the error is not always the same. Sometimes it has this error:
[GET] /api
02:42:37:36
[ERROR] TypeError: expected string or bytes-like object
Traceback (most recent call last):
File "/var/task/vc__handler__python.py", line 63, in vc_handler
conn.request(method, path, headers=headers, body=request_body)
File "/var/lang/lib/python3.9/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/var/lang/lib/python3.9/http/client.py", line 1326, in _send_request
self.putheader(hdr, value)
File "/var/lang/lib/python3.9/http/client.py", line 1262, in putheader
if _is_illegal_header_value(values[i]):
And sometimes it has this error:
[OPTIONS] /api
02:42:37:64
127.0.0.1 - - [30/Jan/2023 07:42:37] code 501, message Unsupported method ('OPTIONS')
127.0.0.1 - - [30/Jan/2023 07:42:37] "OPTIONS /api HTTP/1.1" 501 -
Any idea where I might be going wrong?
Thanks!