title: Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT
body: <p>Running this code everything is fine.</p>
  <pre><code>require('dotenv').config();
  const express = require('express');
  const Firestore = require('@google-cloud/firestore');
  const path = require('path');
  
  
  const app = express();
  
  app.get('/', function (req, res) {
      console.log('hello-cloud-run', 'request received');
  
      const target = process.env.TARGET || 'Juan';
      res.send(`Hello ${target} from Notch - Shopify Webhooks!`);
   });
  
   const port = process.env.PORT || 8080;
  
   app.listen(port,  () =&gt; {
      console.log('Webhook app listening on port ', port);
   });
  </code></pre>
  <p>However if I add the Firestore line (line beginning with const db =) I get the 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.</p>
  <pre><code>require('dotenv').config();
  const express = require('express');
  const Firestore = require('@google-cloud/firestore');
  const path = require('path');
  
  
  const app = express();
  
  const db = new Firestore({
      projectId: 'kuracao-db',
      keyFilename: path.join(__dirname, process.env.GOOGLE_APPLICATION_CREDENTIALS)
  });
  
  
  app.get('/', function (req, res) {
      console.log('hello-cloud-run', 'request received');
  
      const target = process.env.TARGET || 'Juan';
      res.send(`Hello ${target} from Notch - Shopify Webhooks!`);
  });
  
  const port = process.env.PORT || 8080;
  
  app.listen(port,  () =&gt; {
      console.log('Webhook app listening on port ', port);
   });
  </code></pre>
  <p><strong>Why would adding a Firestore db cause a Cloud Run error?</strong></p>
  <p>ERROR: (gcloud.run.deploy) 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.</p>
  <pre><code>FROM node:14
  
  WORKDIR /app
  
  COPY package*.json ./
  
  RUN npm install
  
  COPY . . 
  
  CMD [&quot;npm&quot;, &quot;start&quot;]
  </code></pre>