Azure Spring Cloud applications fail to access the config server - (following vanilla microsoft documentation)

Fiallega, Jorge (ITD) 56 Reputation points
2021-02-02T17:58:26.33+00:00

I am following the tutorial for Azure Spring Cloud:
https://learn.microsoft.com/en-us/azure/spring-cloud/spring-cloud-quickstart-sample-app-introduction?pivots=programming-language-java

the repo url for this demo is: https://github.com/Azure-Samples/piggymetrics
The URI for the config server is: https://github.com/Azure-Samples/piggymetrics-config

I configured the config server and I have created the application by running

   az spring-cloud app create --name gateway  
   az spring-cloud app create --name auth-service  
   az spring-cloud app create --name account-service  

But when I try to deploy the gateway application

   az spring-cloud app deploy -n gateway --jar-path ./gateway/target/gateway.jar  

I get the following error:

Deployment failed. Correlation ID: ----. 112404: Failed to wait for deployment instances to be ready. Please check the application log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later.

and when I check the logs it seems to me that I am getting a 401 error when trying to access the config server

 :: Spring Boot ::        (v2.0.3.RELEASE)  
  
2021-02-02 17:38:21.241  INFO [gateway,,,] 1 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://piggymetrics-xxxxxxxx-asc.svc.azuremicroservices.io/config  
2021-02-02 17:38:22.327 ERROR [gateway,,,] 1 --- [           main] o.s.boot.SpringApplication               : Application run failed  
  
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing  
	at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:136) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]  
	at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) ~[spring-cloud-context-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]  
	at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:633) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]  
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]  
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]  
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]  
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]  
	at com.piggymetrics.gateway.GatewayApplication.main(GatewayApplication.java:14) [classes!/:1.0-SNAPSHOT]  
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_265]  
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_265]  
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_265]  
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_265]  
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]  
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]  
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]  
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [a15ec7d2-d970-43d7-9cce-6679bbd21dc5:1.0-SNAPSHOT]  
Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized  
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:94) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:79) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:766) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:724) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:680) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:600) ~[spring-web-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]  
	at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:218) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]  
	at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:96) ~[spring-cloud-config-client-2.0.0.RELEASE.jar!/:2.0.0.RELEASE]  
	... 15 common frames omitted  
  

I basically would like to get through the quickstarts.
(I have tried upgrading the spring boot version from 2.0.3 2.1.* but I get the same error. If I try to go to a 2.3.8 then I have compilation errors)

Any help would be appreciated.

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
106 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Fiallega, Jorge (ITD) 56 Reputation points
    2021-02-24T12:18:06.39+00:00

    OK. let's leave it at that then.
    It can be closed.
    Thanks


  2. Amit Sinha1 1 Reputation point
    2021-07-09T16:36:58.62+00:00

    I am facing the similar issue when trying to deploy piggymetrics,. @FiallegaJorgelTD did you resolve it ?

    0 comments No comments

  3. urizn 1 Reputation point
    2022-02-08T18:37:44.66+00:00

    for future sufferers, the reason it failed for me is because the default branch in github is now main instead of master so I had to set the label name hint in order for it to find it.

    0 comments No comments