com.google.api.config.ServiceConfigSupplier - Failed to fetch default config version for service (only on localhost)

隐身守侯 提交于 2019-12-04 05:12:38

This may be related to a permission issue if you have pulled all recent updates. git pull Also, check that your Cloud SDK is up-to-date by using: gcloud components update.

Assuming you followed the instructions listed at https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java. To get around this issue you can create a service account with necessary permissions or use the command gcloud auth application-default login.

You can setup a service account using the Cloud SDK gcloud at https://cloud.google.com/sdk/docs/authorizing

Please let me know if you have anymore questions.

As for the command gcloud auth application-default login. According to the help description:

Obtains user access credentials via a web flow and puts them in the well-known location for Application Default Credentials to use them as a proxy for a service account.

When you used this command it obtains credentials for gcloud your Gmail Account. something@gmail.com and then stores the credentials in a location known to contain application credentials.

It's not a fix but I was able to work around the problem by using the advice in https://stackoverflow.com/a/41493548/1410035.

Namely, commenting out the ServiceManagementConfigFilter:

b) Comment out the ServiceManagementConfigFilter from web.xml , ie,

<!--
    <filter>
      <filter-name>endpoints-api-configuration</filter-name>
      <filter-class>com.google.api.control.ServiceManagementConfigFilter</filter-class>
   </filter>
-->

<!--    
<filter-mapping>
    <filter-name>endpoints-api-configuration</filter-name>
    <servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
-->

Note that you have to comment out the filter and the filter-mapping and they aren't right next to each other in the file.

I found that I didn't need to remove the scaling block as mentioned in point 'a' in the linked answer.

It worked with "gradle appengineRun" but on IntelliJ Idea project I had to replace all the ${endpoints.project.id} in web.xml and appengine-web.xml to run/debug localhost from IntelliJ (imported from gradle sources, installed Google Cloud Tools plugin and set up run/debug configuration from Tools/GoogleCloudTools/Run on a local App Engine Standard dev server).

My error was: Failed to fetch default config version for service 'echo-api.endpoints.${endpoints.project.id}.cloud.goog'. No versions exist!

cloud.google.com docs only have Maven build example Gradle build is at github.com

Nicole Yi

Another thing to bare in mind is your service account has the right permission, your service account is something looks like the following

[project ID]@appspot.gserviceaccount.com. 

By default, it is Project(Editor), at least you need to provide it as Service Controller role.

If it is gone, then you can follow these instructions to add back in.

This can happen if you've changed the Google Cloud project you're trying to authenticate to (if someone else has changed the project, this can happen when you pull changes from source control). In this case, the service account credentials that you were using for the old project will no longer be valid, and you can authenticate to the new project by running:

gcloud auth application-default login

I was having this fairly similar error,

endpoints.repackaged.com.google.api.config.ServiceConfigException: Failed to fetch service config (status code 404): The service config name and config id could not be found. Double check that filter initialization parameters endpoints.projectId and endpoints.serviceName are correctly set.

and the issue for me was having ENDPOINTS_SERVICE_VERSION environment variable specified in my appengine-web.xml. So basically, deleting those lines was enough in my case (Since endpoints uses the most recent ENDPOINTS_SERVICE_VERSION if not provided any.):

<env-var name="ENDPOINTS_SERVICE_VERSION" value="1" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!