'Azure Function with GraphQL RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'
Executed 'Functions.GraphQLAPI' (Failed, Id=70c18ea9-5194-4bed-bd04-27c5138e8096, Duration=49ms)
[2022-03-23T11:37:26.657Z] System.Private.CoreLib: Exception while executing function: Functions.GraphQLAPI. System.Private.CoreLib: Result: Failure
Exception: RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.Stack:
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 370, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "C:\Users\vpottupalli\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9\WINDOWS\X64\azure_functions_worker\dispatcher.py", line 548, in _run_sync_func
return func(**params) File "C:\Users\vpottupalli\Documents\Projects\Azure_Repo\GraphQLServer-AzureFunc\GraphQLAPI_init.py", line 14, in main return WsgiMiddleware(app).handle(req, context) File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9\WINDOWS\X64\azure\functions_http_wsgi.py", line 160, in handle return self._handle(req, context) File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9\WINDOWS\X64\azure\functions_http_wsgi.py", line 167, in _handle wsgi_response = WsgiResponse.from_app(self._app, environ) File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9\WINDOWS\X64\azure\functions_http_wsgi.py", line 124, in from_app res._buffer = [x or b'' for x in app(environ, res._start_response)]
Getting this error while executing the azure function and tried with changing the packages versions also. Package Version
anyio 3.5.0
ariadne 0.14.1
azure-functions 1.10.1
graphql-core 3.1.7
idna 3.3
pip 22.0.4
setuptools 58.1.0
sniffio 1.2.0
starlette 0.17.1
typing_extensions 4.1.1
Could you please help me to resolve this issue, even I tried changing the python version 3.8.10 & 3.9.11, but no luck.
I'm trying to setup GraphQl API in Azure function and I'm referring to this https://www.vizeit.com/serverless-graphql-api-on-azure-using-python/
Please help to resolve the above issue
I tried changing the version of azure-functions and extensions and also ariadne but no use.
As I mentioned above I trying to use Azure-function like GraphQL API.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|