Cloud function deployment failed I'm working on a Flutter web app that needs to send SMS and emails through Twilio and SendGrid. To handle emails, I created a Google Cloud Function that triggers every time a new document is created in a Firestore collection called apiusers. The function is supposed to send an email using SendGrid whenever a new user is added to this collection. Could not create or update Cloud Run service sendusernotification, Container Healthcheck failed. Revision 'sendusernotification-00001-wof' 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 within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The healtcheck timeout can be extended. Logs for this revision might contain more information. i functions: cleaning up build files... ⚠ functions: Unhandled error cleaning up build images. This could result in a small monthly bill if not corrected. You can attempt to delete these images by redeploying or you can delete them manually at https://console.cloud.google.com/gcr/images/**/eu/gcf This is my index.js index.js file: const { onDocumentCreated } = require('firebase-functions/v2/firestore'); const functions = require('firebase-functions'); const admin = require('firebase-admin'); const sgMail = require('@sendgrid/mail'); const twilio = require('twilio'); admin.initializeApp(); const SENDGRID_API_KEY =functions.config().sendgrid.key; const TWILIO_SID = functions.config().twilio.sid; const TWILIO_TOKEN = functions.config().twilio.token; sgMail.setApiKey(SENDGRID_API_KEY); const twilioClient = twilio(TWILIO_SID, TWILIO_TOKEN); exports.sendUserNotification = onDocumentCreated( { document: '<Firestore-Collection>/{userId}', region: 'europe-west2', }, async (event) => { const snapshot = event.data; const userData = snapshot.data(); const { Email, FirstName, LastName, Password } = userData; const emailMessage = { to: <receiver-email-address>, from: <sender-email-address> subject: 'New User Account Created', text: `An Email ${Email} has been created with account name ${FirstName} ${LastName}. Here are the login credentials: username - ${Email}, password - ${Password}`, }; const smsMsg = { body: `Account created for ${FirstName} ${LastName}. Username: ${Email}, password: ${Password}`, from: <sender-contact number> to: <receiver-contact-number>, }; try { await sgMail.send(emailMessage); console.log('Email sent successfully'); await twilioClient.messages.create(smsMsg); console.log('SMS sent successfully'); } catch (error) { console.error('Error sending notification:', error); } } ); this my package.json { "name": "functions", "description": "Cloud Functions for Firebase", "scripts": { "serve": "firebase emulators:start --only functions", "shell": "firebase functions:shell", "start": "node index.js", "deploy": "firebase deploy --only functions", "logs": "firebase functions:log" }, "engines": { "node": "18" }, "main": "index.js", "dependencies": { "@sendgrid/mail": "^8.1.4", "cors": "^2.8.5", "firebase-admin": "^12.7.0", "firebase-functions": "^6.0.1", "moment-timezone": "^0.5.46", "twilio": "^5.3.5" }, "devDependencies": { "firebase-functions-test": "^3.1.0" }, "private": true } Continue reading...