google-cloud-platformgoogle-cloud-rungoogle-cloud-endpoints-v2

Getting Started with Endpoints for Cloud Run - Request Timeout or Request Too Large Errors


Preface

I've just finished the Getting Started with Endpoints for Cloud Run tutorial for the second time. When I first tried running this tutorial with my own Cloud Run app, I got either a 413 Request too large or 504 Upstream request timeout error. Thinking that I may have taken too large a leap trying to deploy Endpoints on my Cloud Run service, I started the tutorial over using only the tutorial code, i.e., creating a Cloud Run service with the Cloud Run quickstart and using the given YAML in the Endpoints tutorial. Unfortunately, again, after running through all the commands, enabling services, and deploying Endpoints, I get either 413 Request too large or 504 Upstream request timeout.

Issue

Following the Getting Started with Endpoints for Cloud Run, I get either a 413 Request too large or 504 Upstream request timeout error. I feel like I must be missing something major, as I can't find any other comments or documentation on this issue. Has anyone run into this issue before or does anyone have advice as to how I can debug the issue?

What I've Tried So Far

Beyond restarting the tutorial with the Cloud Run tutorial image, I've looked at the logs and seen that one request creates many error logs within milliseconds of each other. To be clear, the Cloud Run service is functioning, as I've tested both my own and Google's service without the Endpoints layer. I didn't have any issues accessing the services then.

Let me know what else I can provide, and thanks in advance for any help.


Solution

  • I was able to reproduce your issue.

    In order to work with Cloud Endpoints with Cloud Run you need at least two services deployed:

    1. Your destination service (hello), a dummy service can be created from the Quickstart.
    2. The endpoint service (gateway), which will be the one redirecting the requests.

    In this case you probably had HOST to wrongly be gateway-HASH-uc.a.run.app:

    ...
    host: HOST
    ...
    x-google-backend:
      address: https://gateway-HASH-uc.a.run.app
    

    The Host is the 2nd service, and the x-google-backend is the 1st service.

    To fix the issue you have to deploy another service and redo the tutorial.