spring-cloud / spring-cloud/spring-cloud-config
No HttpServletRequest available exception when using Vault with embedded Cloud Config Server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 1.3k
- Avg merge
- 2d 59m
- Merged PRs (30d)
- 16
Description
Hi,
I am getting a similar error as reported in issue #1393. Moving to 2.1.3.RELEASE doesn't seem to have resolved the bug completely - or maybe i'm missing something else. Please advice. Below is the stack error stack i get.
Caused by: java.lang.IllegalStateException: No HttpServletRequest available
at org.springframework.cloud.config.server.environment.HttpRequestConfigTokenProvider.getToken(HttpRequestConfigTokenProvider.java:41) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.getToken(VaultEnvironmentRepository.java:218) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.read(VaultEnvironmentRepository.java:209) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.config.server.environment.VaultEnvironmentRepository.findOne(VaultEnvironmentRepository.java:147) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.config.server.environment.CompositeEnvironmentRepository.findOne(CompositeEnvironmentRepository.java:52) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.config.server.environment.EnvironmentRepositoryPropertySourceLocator.locate(EnvironmentRepositoryPropertySourceLocator.java:55) ~[spring-cloud-config-server-2.1.3.RELEASE.jar:2.1.3.RELEASE]
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) ~[spring-cloud-context-2.0.2.RELEASE.jar:2.0.2.RELEASE]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:628) ~[spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:364) ~[spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) ~[spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
I've attached the sample project which replicated this error
vault-config-server.zip
thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the attached vault-config-server.zip sample and read the stack-trace entry points HttpRequestConfigTokenProvider.getToken and VaultEnvironmentRepository.read/findOne. Trace why startup reaches these methods without an HttpServletRequest. Done means the embedded Cloud Config Server starts and uses Vault without the IllegalStateException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100