Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESPv2 with Google Cloud Functions upstream request timeout

I'm having issue getting answers from a Google Coud Function going through ESPv2. Every time I request it, I get a response 15 seconds later with a status code of 504. My function take between 30 to 45 seconds. In the logs the functions correctly and answer back after 35 seconds.

Is there a way to increase the timeout in ESPv2 ?

Thanks

like image 497
Mathieu A. Avatar asked Mar 18 '20 11:03

Mathieu A.


2 Answers

For anyone else having this issue, in the openapi-functions.yaml under the x-google-backend you should had the attribut deadline and set it to whatever value in seconds you want.

Here is the hidden documentation https://cloud.google.com/endpoints/docs/openapi/openapi-extensions#deadline

Issue related: https://github.com/GoogleCloudPlatform/esp-v2/issues/4

like image 165
Mathieu A. Avatar answered Oct 11 '22 18:10

Mathieu A.


Depending on the documentation you used to secure the endpoints of your Cloud Function’s with ESPv2, this should be possible. If you are using Cloud Run to host your ESPv2, a 504 error is sent when a request exceeds its request timeout limit. The request timeout limit is a setting that specifies the time within which a response must be returned before sending a 504 response. You can change this value by going in your “Cloud Run” tab, selecting your ESPv2 service, selecting “Edit & Deploy new Revision”, scrolling down to the capacity section and setting the time in milliseconds. This is some documentation that could prove helpful when working with the topics discussed.

like image 22
Alfio Ranieri Avatar answered Oct 11 '22 17:10

Alfio Ranieri