Search code examples
google-cloud-platformgoogle-cloud-endpoints

Run a ESP local for development


When i try to run a local ESP then i get this error.

ERROR:Fetching service config failed(status code 403, reason Forbidden, url ***)

I have a new created service account this account works fine with gcloud cli.

System: OSX Sierra with Docker for MAC

this is the command that i use to start the container:

docker run -d --name="esp" --net="host" -v ~/Downloads:/esp gcr.io/endpoints-release/endpoints-runtime:1.0 -s 2017-02-07r5 -v echo.endpoints.****.cloud.goog -p 8082 -a localhost:9000  -k /esp/serviceaccount.json

UPDATE:

I have found the error i have set for the service name the verision and for the version the servicename.

Now i get no error but it not works, this is the console output from the container. From my view is all fine but it not works, i can't call the proxy with localhost:8082/***

INFO:Constructing an access token with scope https://www.googleapis.com/auth/service.management.readonly
INFO:Service account email: aplha-api@****.iam.gserviceaccount.com
INFO:Refreshing access_token
INFO:Fetching the service configuration from the service management service
nginx: [warn] Using trusted CA certificates file: /etc/nginx/trusted-ca-certificates.crt

This is the used correct command:

 docker run -d --name="esp-user-api" --net="host" -v ~/Downloads:/esp gcr.io/endpoints-release/endpoints-runtime:1.0 -s echo.endpoints.***.cloud.goog  -v 2017-02-07r5  -p 8082 -a localhost:9000 -k /esp/serviceaccount.json

Solution

  • Aron, I assume: (1) you are following this user guide: https://cloud.google.com/endpoints/docs/running-esp-localdev

    (2) And you do have a backend running on localhost:9000

    Have you issued a curl request as suggested in that user guide to localhost:8082/***? does curl command get stuck or returns any error message?

    If you don't have a local backend running yet, I would recommend you to follow the user guide above to run a local backend. Note this guide will instruct you to run it at port 8080, so you'll need to change your docker run command from "-a localhost:9000" to "-a localhost:8080" as well.

    Also, please note this user guide is for linux env. We haven't tried this set up in a Mac env yet. We do notice some user gets this working on Windows docker with extra work, where he sets backend to "IP of docker NIC". Note "-a" is short for "--backend".

    see https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-cloud-endpoints/4sRaSkigPiU/KY8g46NSBgAJ