I am getting an error when trying to import the Google BigQuery Python Client in an Azure Function. This works fine if I test somewhere else like a local script or Jupyter Notebook.
Importing the following to the out of the box Http Trigger function:
from google.cloud import bigquery
Leads to this error:
[2022-08-02T21:01:52.607] Worker failed to function id ec06ba50-3e6a-4352-84a9-7376e440da11.
[2022-08-02T21:01:52.608] Result: Failure
Exception: AttributeError: 'NoneType' object has no attribute 'message_types_by_name'
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 262, in _handle__function_load_request
func = loader.load_function(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8/WINDOWS/X64\azure_functions_worker\utils\wrappers.py", line 32, in call
return func(*args, **kwargs)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.8/WINDOWS/X64\azure_functions_worker\loader.py", line 76, in load_function
mod = importlib.import_module(fullmodname)
File "C:\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\admin\Desktop\TestFuncApp\TestHttpTrigger\__init__.py", line 5, in <module>
from google.cloud import bigquery
File "c:\Users\admin\Desktop\TestFuncApp\.venv\lib\site-packages\google\cloud\bigquery\__init__.py", line 35, in <module>
from google.cloud.bigquery.client import Client
File "c:\Users\admin\Desktop\TestFuncApp\.venv\lib\site-packages\google\cloud\bigquery\client.py", line 52, in <module>
import google.api_core.exceptions as core_exceptions
File "c:\Users\admin\Desktop\TestFuncApp\.venv\lib\site-packages\google\api_core\exceptions.py", line 29, in <module>
from google.rpc import error_details_pb2
File "c:\Users\admin\Desktop\TestFuncApp\.venv\lib\site-packages\google\rpc\error_details_pb2.py", line 39, in <module>
_RETRYINFO = DESCRIPTOR.message_types_by_name["RetryInfo"]
I am getting an error when trying to import the Google BigQuery Python Client in an Azure Function. This works fine if I test somewhere else like a local script or Jupyter Notebook.
Importing the following to the out of the box Http Trigger function:
from google.cloud import bigquery
Leads to this error: