-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking change in 3.1.8: using config.import with gives "[//] give is not a valid HTTP URL" #2304
Comments
@ryanjbaxter Hi Ryan, this codechange 9f3ad4f is breaking the use of for example "optional:vault://" in the spring.config.import property. The "//" as uri should be allowed also. The urisHashCode calls UriComponentsBuilder.fromHttpUrl which results in above error. |
@ryanjbaxter will this be also added to spring-cloud-dependencies 2021.0.9? |
Correct the fix went into the 3.1.x, 4.0.x, and main branches |
@ryanjbaxter the issue still occurs when using the newest spring-cloud-config-client 4.0.4, but now as a WARN:
Using these dependencies:
Using spring-cloud-config-client 4.0.2 (spring cloud 2022.0.2) this WARN is not thrown. |
@MarkvanOsch the problem is actually this line |
@ryanjbaxter I tried with several setups, but above fails with:
It seems like the behaviour of import checking is changed. This is my setup that I use and works fine in cloud env, only in local dev and test gives a WARN. This works fine in local dev with: But gives a WARN with: Is this a different issue maybe? |
If you remove ‘//‘ from the spring.config.import statement does the warning go away with 2202.0.4? |
No, then I get this ERROR:
|
And you have spring cloud config on the class path and it’s enabled? Can you provide a sample that reproduces the problem? |
I think this discussion is now active again: #1877 So I should change my application.yml to this setup and only do the import on my cloud profiles. It that the way forward? Or even this because the environment variable should be available in the cloud environments: Still curious why the WARN is now happening with when using spring.cloud.import in the default profile: |
The last image seems right. Hard for me to say why you see the warning now with the default profile, I need an example to look at. // was never a valid was to tell the conflig client to use the default url like it is for vault |
Thanks, I will provide a sample to reproduce. |
Sample project to reproduce, with readme. |
Thanks! This is kind of interesting but the behavior is now expected. Spring Boot's config data loading happens in 2 phases:
Prior to 2022.0.3 the config client skipped 1 and only did 2. Now since we also do 1 your import statement is being run by the config client to try and load configuration without the dev profile active and you see the warning. Then after the dev profile gets active the config client config data loader doesn't run in phase 2. I think the reason why you are seeing These are actually 2 completely unrelated behaviors :) |
Thanks Ryan, it's clear to me now. 👍 In our setup I will go forward to moving the config.import to the specific cloud profile. So not use it in the default. |
I am trying to load vault using
Can anyone help me get why this is still happening on local dev environment? I am using spring cloud |
@ENate Hi, this is the setup we now use which solves the earlier issues. It supports local development (without vault/configserver) and cloud deployments (with vault/configserver) using profiles. Maybe you can use it to double check your setup? |
Hi @MarkvanOsch thanks. I tried to import both vault and config server properties for other services but still getting an error with the property source not found. The issue is: I locked my config server using spring security (and implemented login calls from a database). Next, I will also want services to use the login details which I provided via vault to load their properties from config server. I do not know whether it is best to fetch login details directly from the config server database. But I still feel it is sufficient to provide the login for other services via vault for them to be picked up. But the issue could be with the property source not being loaded. The config--server runs fine. The main issue is the inability for other services to pick up the secrets from vault and login to the config server - since it seems they all fail to load vault. Thanks again |
Describe the bug
After upgrading from 3.1.7 to 3.1.8 using config.import with optional and using default "://" gives a "[//] is not a valid HTTP URL error".
Stacktrace:
Sample
Using this config in application.yml:
As reference this should still be valid use:
Conditionally enable/disable Vault Configuration
In some cases, it can be required to launch an application without Vault. You can express whether a Vault config location should be optional or mandatory (default) through the location string:
optional:vault:// (default location)
See: https://docs.spring.io/spring-cloud-vault/docs/current/reference/html/config-data.html
Using these dependencies:
The text was updated successfully, but these errors were encountered: