Firebase部署错误:云函数onWorkFormCreated等Cloud Run健康检查失败
Firebase云函数部署失败:容器健康检查不通过
错误信息
Could not create or update Cloud Run service onworkformcreated, Container Healthcheck failed. Revision 'onworkformcreated-00001-hab' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable.
自定义代码
/* eslint-disable */ const admin = require("firebase-admin"); const sgMail = require("@sendgrid/mail"); const { onValueCreated } = require("firebase-functions/v2/database"); const functions = require("firebase-functions"); // Initialize Firebase const serviceAccount = require("../firebase-adminsdk.json"); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "Firebase Realtime Database URL", }); // Initialize SendGrid const sendgridApiKey = functions.config().sendgrid.key; sgMail.setApiKey(sendgridApiKey); // Sender email const senderEmail = "some@gmail.com"; // Function to send confirmation email async function sendConfirmationEmail(userType, userEmail, firstName, lastName) { // Email Content goes here } // Realtime Database trigger for 'work' node exports.onWorkFormCreated = onValueCreated("/work/{pushId}", (event) => { const formData = event.data.val(); sendConfirmationEmail( formData.userType, formData.email, formData.firstName, formData.lastName, ); }); // Realtime Database trigger for 'talent' node exports.onTalentFormCreated = onValueCreated("/talent/{pushId}", (event) => { const formData = event.data.val(); sendConfirmationEmail( formData.userType, formData.email, formData.firstName, formData.lastName, ); });
已尝试使用Node.js 16、18、20多个版本部署,但问题依然存在。
内容的提问来源于stack exchange,提问作者sachi
相关产品推荐
相关产品推荐

