-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError('There is no current event loop in thread %r.') #58
Comments
This could be a new |
Yup, just deployed https://test-if-vercel-publish-broken.vercel.app/ with this and I'm getting the same error:
|
I think this is because of changes to Vercel's Python support. I happened to have a copy of the working https://gist.github.com/simonw/8521ba3385279fde4a9878f2ad8d150a/revisions That diff does indeed show newly added code that calls def get_event_loop():
try:
return asyncio.get_running_loop()
except:
if sys.version_info < (3, 10):
return asyncio.get_event_loop()
else:
return asyncio.get_event_loop_policy().get_event_loop() |
It looks to me like this commit introduced the bug: vercel/vercel@66c8544 It was supposed to fix an issue in Python 3.10. I'm still running Python 3.9 here - so maybe upgrading to Python 3.10 will work around this issue. |
The docs at https://vercel.com/docs/runtimes#official-runtimes/python/python-version suggest that you can't run anything other than Python 3.6 or 3.9. |
From the PR at https://github.com/vercel/vercel/pull/8045/files it looks like I might be able to use a |
I tried a manual deploy using the output from I had to delete This
Seems to have worked in that I'm not getting the old error - I think it deployed Python 3.10 though I've not confirmed it yet, because now I get this error instead:
|
Alternative workaround, maybe try pinning https://www.npmjs.com/package/@vercel/python to |
Here's how to pin that: https://github.com/vercel-support/flask-test/blob/e8b6f669787c5a7a1343c1e78660ea26407c2a0c/vercel.json#L6 {
"version": 2,
"builds": [
{
"src": "index.py",
"use": "@vercel/[email protected]"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/"
}
]
} |
Yes, this seems to fix it:
|
https://til.simonwillison.net/ site is down at the moment:
Logs at https://vercel.com/datasette/simon-til/9SYmpgw4ExnTbRLnsevw5zXXTRgb/functions show:
[ERROR] RuntimeError: There is no current event loop in thread 'MainThread'.Traceback (most recent call last): File "/var/task/vc__handler__python.py", line 453, in vc_handler lifespan = Lifespan(__vc_module.app) File "/var/task/vc__handler__python.py", line 308, in __init__ self.loop = get_event_loop() File "/var/task/vc__handler__python.py", line 184, in get_event_loop return asyncio.get_event_loop() File "/var/lang/lib/python3.9/asyncio/events.py", line 642, in get_event_loop raise RuntimeError('There is no current event loop in thread %r.'
The text was updated successfully, but these errors were encountered: