Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud function gen2 issue with longer execution

Hello, 

   Did anyone tried using the cloud function gen2 HTTP trigger with longer timeout? 
As the gen2 HTTP Cloud function uses Cloud Run and cloud run expects a port to be set on listening not sure what sense it makes to setup a cloud function to have a listening port on code.

 

0 1 278
1 REPLY 1

Hi @madhusm,

A Cloud Run injects the PORT environment variable into the container. Inside Cloud Run container instances, the value of the PORT environment variable always reflects the port to which requests are sent. It defaults to 8080

Your container must be running a processing that's listening on port 8080, or whatever the PORT environment variable is. If it's not doing that, it can't receive incoming requests.

Cloud Functions you write simple, single-purpose functions that are attached to events emitted from your cloud infrastructure and services. Your function is triggered when an event being watched is fired, or by an HTTP request.

See also Cloud Run troubleshooting documentationContainer runtime contract and Cloud Function to Cloud Run.

 

Thank you