Henry Tseng
Henry Tseng

Reputation: 3333

Receiving an error with Google Cloud Endpoints with Cloudrun for ENDPOINTS_SERVICE_NAME environment variable

Receiving the following error message after setting up backend service with ESPv2 Beta sidecar container.

Serverless ESPv2 expects ENDPOINTS_SERVICE_NAME in environment variables.

 Did you forget to build the Endpoints service configuration
 into the ESPv2 image? Please refer to the official serverless
 quickstart tutorials (below) for more information.

 https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-run#configure_esp
 https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions#configure_esp

 If you are following along with these tutorials but have not
 reached the step above yet, this error is expected. Feel free
 to temporarily disregard this error message.

 If you wish to skip this step, please specify the name of the
 service in the ENDPOINTS_SERVICE_NAME environment variable.
 Note this deployment mode is **not** officially supported.
 It is recommended that you follow the tutorials linked above.

Looks like I was able to setup the cloud run service correctly able to get responses directly from the API.

Reviewing the gcloud_build_image it doesn't seem to have the variable.

https://github.com/GoogleCloudPlatform/esp-v2/blob/9a5a03d439867b0d5563081ac574e94d51922c32/docker/serverless/gcloud_build_image#L53

Upvotes: 1

Views: 820

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75745

Update your Cloud Run environment variable where is deployed Cloud Endpoint like this

gcloud beta run services update <SERVICE NAME> \
--set-env-vars ENDPOINTS_SERVICE_NAME=<SERVICE NAME>-<hash>-<REGION>.a.run.app \
--region <REGION> --platform managed

More details in my article

Upvotes: 5

Related Questions