部署 Firebase Function 但选择 Python 而不是 TS

问题描述 投票:0回答:1

刚刚使用

firebase init functions
将 Firebase Functions 安装到我的项目中,并选择 Python 作为我的语言而不是 TS。当我尝试部署测试功能时,出现错误

Error: Could not detect language for functions at /home/foo/bar/myproject/functions

该功能只是默认功能:

# Welcome to Cloud Functions for Firebase for Python!
# To get started, simply uncomment the below code or create your own.
# Deploy with `firebase deploy`

from firebase_functions import https_fn
from firebase_admin import initialize_app

initialize_app()


@https_fn.on_request()
def on_request_example(req: https_fn.Request) -> https_fn.Response:
    return https_fn.Response("Hello world!")

我已经使用诗歌设置了我的环境并安装了requirements.txt。选择 python 而不是 TS 时我是否遗漏了什么?

firebase google-cloud-functions
1个回答
0
投票

Firebase 无法正确识别 python。 检查“package.json”文件指定正确的 python 运行时。

© www.soinside.com 2019 - 2024. All rights reserved.