我正在尝试使用Python 3.7部署一个简单的函数。我的设置如下:
main.py
# Function dependencies, for example:
# package>=version
requests==1.1.0
python-firebase==1.2
requirements.txt
Deployment failure:
Function failed on loading user code. Error message: Code in file main.py can't be loaded.
Detailed stack trace: Traceback (most recent call last):
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 305, in check_or_load_user_function
_function_handler.load_user_function()
File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 184, in load_user_function
spec.loader.exec_module(main)
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 1, in <module>
from firebase import firebase
File "/env/local/lib/python3.7/site-packages/firebase/__init__.py", line 3
from .async import process_pool
^
SyntaxError: invalid syntax
部署时,出现以下错误:
{{1}}
如何解决此问题?我列出了所有必需的依赖项。任何帮助表示赞赏。
答案 0 :(得分:1)
python-firebase
项目是由第三方开发人员last released on March 21, 2014进行的,不支持Python 3.7。具体来说,它使用新的保留关键字async
/ await
。
您可能想改为使用google-cloud-firestore
客户端库,该客户端库由Google维护和支持。