You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 14:05:00