我想创建下面的firebase云函数:
import * as functions from "firebase-functions";
export const myCloudFunction = functions
.runWith({vpcConnector: process.env.VPC_CONNECTOR})
.region("asia-south1").https.onRequest(app);
但是,当我部署这个函数时,它无法读取环境变量(我已经检查过它在其他地方工作正常)。我得到以下错误:
VPC connector projects/my-project/locations/asia-south1/connectors/undefined is not ready yet or does not exist.
但是,如果我提供一个静态值,即vpcConnector: "my-google-vpc"
,一切正常!
先谢谢你了。
1条答案
按热度按时间9lowa7mx1#
当firebase工具在部署期间阅读代码时,环境变量似乎不可用[ discussion ]
我不得不使用firebase参数从环境变量中获取VPC_CONNECTOR的值: