Deployment error in Firebase cloud function

Viewed 168

getting firebase deployment error while keep both code listen the port and cloud function in node.js server file

The error:

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);
1 Answers

Posting @NiravLathiya's above comment as community wiki.

Extending the Firebase function memory limit and timeout solved the problem.

Related