谷歌云功能未能部署到新区域



我有一个最初部署到us-central1的python云函数。当试图将此函数部署到us-east4时,我在加载代码时遇到以下错误:

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. This is likely due to a bug in the user code. Error message: with_scopes_if_required() got an unexpected keyword argument 'default_scopes'
Detailed stack trace:
Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v2.py", line 359, in check_or_load_user_function
_function_handler.load_user_function()
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker_v2.py", line 236, in load_user_function
spec.loader.exec_module(main_module)
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/user_code/main.py", line 20, in <module>
client_options={'api_endpoint': '{}-dataproc.googleapis.com:443'.format(REGION)})
File "/env/local/lib/python3.7/site-packages/google/cloud/dataproc_v1/services/workflow_template_service/client.py", line 244, in __init__
quota_project_id=client_options.quota_project_id,
File "/env/local/lib/python3.7/site-packages/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py", line 134, in __init__
quota_project_id=quota_project_id,
File "/env/local/lib/python3.7/site-packages/google/cloud/dataproc_v1/services/workflow_template_service/transports/grpc.py", line 190, in create_channel
**kwargs
File "/env/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 311, in create_channel
default_host=default_host,
File "/env/local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 238, in _create_composite_credentials
default_scopes=default_scopes
TypeError: with_scopes_if_required() got an unexpected keyword argument 'default_scopes'
. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.

这是我代码中的一行,错误是抱怨

DATAPROC_WORFLOW_CLIENT = dataproc_v1.WorkflowTemplateServiceClient(
client_options={'api_endpoint': '{}-dataproc.googleapis.com:443'.format(REGION)})

我在部署过程中传入REGION env变量。使用us-central1运行相同的deploy命令没有问题。在这些部署之间没有任何代码更改。

在requirements.txt中升级google auth和google-auth-httplib2库修复了该问题。

相关内容

  • 没有找到相关文章

最新更新