Firebase 云函数中的部署错误
Deployment error in Firebase cloud function
获取 firebase 部署错误,同时保持代码在 node.js 服务器文件中监听端口和云功能
错误:
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
const functions = require("firebase-functions");
const express = require('express');
const app = express();
require('dotenv').config();
app.get('/', (req, res,next) => {
res.send(`Hello world received a request!\n`);
next();
});
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log('Hello world listening on port', port);
});
exports.cloudrun = functions.https.onRequest(app);
将@NiravLathiya 的上述评论发布为社区 wiki。
扩展 Firebase 函数内存限制和超时解决了问题。
获取 firebase 部署错误,同时保持代码在 node.js 服务器文件中监听端口和云功能
错误:
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information.
const functions = require("firebase-functions");
const express = require('express');
const app = express();
require('dotenv').config();
app.get('/', (req, res,next) => {
res.send(`Hello world received a request!\n`);
next();
});
const port = process.env.PORT || 5000;
app.listen(port, () => {
console.log('Hello world listening on port', port);
});
exports.cloudrun = functions.https.onRequest(app);
将@NiravLathiya 的上述评论发布为社区 wiki。
扩展 Firebase 函数内存限制和超时解决了问题。