Skip to content
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

Vault DB credentials provider with reactive-pg-client #78

Closed
Michal-Kucera opened this issue Sep 15, 2022 · 28 comments · Fixed by #109
Closed

Vault DB credentials provider with reactive-pg-client #78

Michal-Kucera opened this issue Sep 15, 2022 · 28 comments · Fixed by #109

Comments

@Michal-Kucera
Copy link

Michal-Kucera commented Sep 15, 2022

Hello!

I'm struggling with setting up Vault credentials provider for postgres DB, while using reactive-stack as much as possible. I'm getting the following stack trace:

2022-09-15T14:25:21.489236982Z __  ____  __  _____   ___  __ ____  ______ 
2022-09-15T14:25:21.489354273Z  --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
2022-09-15T14:25:21.489362656Z  -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
2022-09-15T14:25:21.489366226Z --\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
2022-09-15T14:25:21.492381899Z 2022-09-15 14:25:20,766 WARN  [io.qua.vau.run.TimeLimitedBase] (vert.x-eventloop-thread-1) auth lease duration 60s is smaller than the renew grace period 3600s
2022-09-15T14:25:21.613495011Z 2022-09-15 14:25:21,612 INFO  [io.qua.sma.ope.run.OpenApiRecorder] (main) Default CORS properties will be used, please use 'quarkus.http.cors' properties instead
2022-09-15T14:25:22.144796294Z 2022-09-15 14:25:22,130 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): javax.enterprise.inject.CreationException: Synthetic bean instance for io.vertx.core.Vertx not initialized yet: io_vertx_core_Vertx_97d170e1550eee4afc0af065b78cda302a97674c
2022-09-15T14:25:22.145156994Z 	- a synthetic bean initialized during RUNTIME_INIT must not be accessed during STATIC_INIT
2022-09-15T14:25:22.145225177Z 	- RUNTIME_INIT build steps that require access to synthetic beans initialized during RUNTIME_INIT should consume the SyntheticBeansRuntimeInitBuildItem
2022-09-15T14:25:22.145243157Z 	at io.vertx.core.Vertx_7c31d5064e6d5db248fafa10f188ca6323f3f983_Synthetic_Bean.create(Unknown Source)
2022-09-15T14:25:22.145272470Z 	at io.vertx.core.Vertx_7c31d5064e6d5db248fafa10f188ca6323f3f983_Synthetic_Bean.create(Unknown Source)
2022-09-15T14:25:22.145292800Z 	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
2022-09-15T14:25:22.145298479Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
2022-09-15T14:25:22.145345922Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145427267Z 	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
2022-09-15T14:25:22.145444088Z 	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
2022-09-15T14:25:22.145450024Z 	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145454383Z 	at io.vertx.core.Vertx_7c31d5064e6d5db248fafa10f188ca6323f3f983_Synthetic_Bean.get(Unknown Source)
2022-09-15T14:25:22.145458671Z 	at io.vertx.core.Vertx_7c31d5064e6d5db248fafa10f188ca6323f3f983_Synthetic_Bean.get(Unknown Source)
2022-09-15T14:25:22.145478556Z 	at io.quarkus.vertx.runtime.VertxProducer_ProducerMethod_mutiny_d5befbd244a8a884fd08fff108d174c7e738c2d3_Bean.create(Unknown Source)
2022-09-15T14:25:22.145484436Z 	at io.quarkus.vertx.runtime.VertxProducer_ProducerMethod_mutiny_d5befbd244a8a884fd08fff108d174c7e738c2d3_Bean.create(Unknown Source)
2022-09-15T14:25:22.145524161Z 	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
2022-09-15T14:25:22.145531339Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
2022-09-15T14:25:22.145535408Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145554426Z 	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
2022-09-15T14:25:22.145565127Z 	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
2022-09-15T14:25:22.145570026Z 	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145573902Z 	at io.quarkus.vertx.runtime.VertxProducer_ProducerMethod_mutiny_d5befbd244a8a884fd08fff108d174c7e738c2d3_Bean.get(Unknown Source)
2022-09-15T14:25:22.145615328Z 	at io.quarkus.vertx.runtime.VertxProducer_ProducerMethod_mutiny_d5befbd244a8a884fd08fff108d174c7e738c2d3_Bean.get(Unknown Source)
2022-09-15T14:25:22.145622700Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_Bean.create(Unknown Source)
2022-09-15T14:25:22.145626914Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_Bean.create(Unknown Source)
2022-09-15T14:25:22.145630928Z 	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
2022-09-15T14:25:22.145650862Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
2022-09-15T14:25:22.145657897Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145662088Z 	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
2022-09-15T14:25:22.145683333Z 	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
2022-09-15T14:25:22.145688125Z 	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145691958Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_Bean.get(Unknown Source)
2022-09-15T14:25:22.145695540Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_Bean.get(Unknown Source)
2022-09-15T14:25:22.145716680Z 	at io.quarkus.arc.impl.InstanceImpl.getBeanInstance(InstanceImpl.java:223)
2022-09-15T14:25:22.145722739Z 	at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:209)
2022-09-15T14:25:22.145756351Z 	at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:95)
2022-09-15T14:25:22.145763873Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient.createSharedVaultClient(SharedVertxVaultClient.java:34)
2022-09-15T14:25:22.145783072Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_ProducerMethod_createSharedVaultClient_5ecb0fe9a07b0ac40b7d488beafecdf9372c5594_Bean.create(Unknown Source)
2022-09-15T14:25:22.145790263Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_ProducerMethod_createSharedVaultClient_5ecb0fe9a07b0ac40b7d488beafecdf9372c5594_Bean.get(Unknown Source)
2022-09-15T14:25:22.145794527Z 	at io.quarkus.vault.runtime.client.SharedVertxVaultClient_ProducerMethod_createSharedVaultClient_5ecb0fe9a07b0ac40b7d488beafecdf9372c5594_Bean.get(Unknown Source)
2022-09-15T14:25:22.145843590Z 	at io.quarkus.vault.runtime.VaultDynamicCredentialsManager_Bean.create(Unknown Source)
2022-09-15T14:25:22.145851046Z 	at io.quarkus.vault.runtime.VaultDynamicCredentialsManager_Bean.create(Unknown Source)
2022-09-15T14:25:22.145855027Z 	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
2022-09-15T14:25:22.145859026Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
2022-09-15T14:25:22.145862728Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145922527Z 	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
2022-09-15T14:25:22.145947183Z 	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
2022-09-15T14:25:22.145953546Z 	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.145983152Z 	at io.quarkus.vault.runtime.VaultDynamicCredentialsManager_Bean.get(Unknown Source)
2022-09-15T14:25:22.146014463Z 	at io.quarkus.vault.runtime.VaultDynamicCredentialsManager_Bean.get(Unknown Source)
2022-09-15T14:25:22.146114730Z 	at io.quarkus.vault.runtime.VaultCredentialsProvider_Bean.create(Unknown Source)
2022-09-15T14:25:22.146129926Z 	at io.quarkus.vault.runtime.VaultCredentialsProvider_Bean.create(Unknown Source)
2022-09-15T14:25:22.146144997Z 	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
2022-09-15T14:25:22.146151762Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
2022-09-15T14:25:22.146154521Z 	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.146157145Z 	at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
2022-09-15T14:25:22.146159754Z 	at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
2022-09-15T14:25:22.146208250Z 	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
2022-09-15T14:25:22.146222034Z 	at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:19)
2022-09-15T14:25:22.146274767Z 	at io.quarkus.vault.runtime.VaultCredentialsProvider_ClientProxy.arc$delegate(Unknown Source)
2022-09-15T14:25:22.146290141Z 	at io.quarkus.vault.runtime.VaultCredentialsProvider_ClientProxy.getCredentials(Unknown Source)
2022-09-15T14:25:22.146314254Z 	at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.toPgConnectOptions(PgPoolRecorder.java:138)
2022-09-15T14:25:22.146387747Z 	at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.initialize(PgPoolRecorder.java:68)
2022-09-15T14:25:22.146411127Z 	at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.configurePgPool(PgPoolRecorder.java:47)
2022-09-15T14:25:22.146467146Z 	at io.quarkus.deployment.steps.ReactivePgClientProcessor$build897843755.deploy_0(Unknown Source)
2022-09-15T14:25:22.146513866Z 	at io.quarkus.deployment.steps.ReactivePgClientProcessor$build897843755.deploy(Unknown Source)
2022-09-15T14:25:22.146522976Z 	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
2022-09-15T14:25:22.146535574Z 	at io.quarkus.runtime.Application.start(Application.java:101)
2022-09-15T14:25:22.146544074Z 	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
2022-09-15T14:25:22.146549819Z 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:69)
2022-09-15T14:25:22.146554184Z 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
2022-09-15T14:25:22.146558218Z 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:122)
2022-09-15T14:25:22.146562436Z 	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
2022-09-15T14:25:22.146582795Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2022-09-15T14:25:22.146586882Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2022-09-15T14:25:22.146589592Z 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2022-09-15T14:25:22.146592197Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
2022-09-15T14:25:22.146594738Z 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:60)
2022-09-15T14:25:22.146597312Z 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:31)
2022-09-15T14:25:22.146599900Z 

I have got the following dependencies:

implementation(kotlin("stdlib-jdk8"))

val quarkusBomVersion = "2.12.2.Final"
val kotlinLoggingJvmVersion = "2.1.23"
implementation(enforcedPlatform("io.quarkus.platform:quarkus-bom:$quarkusBomVersion"))

implementation("io.quarkus:quarkus-kotlin")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
implementation("io.quarkus:quarkus-config-yaml")
implementation("io.quarkus:quarkus-arc")
implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingJvmVersion")
implementation("io.quarkus:quarkus-smallrye-health")
implementation("io.quarkiverse.vault:quarkus-vault")
implementation("io.quarkus:quarkus-resteasy-reactive")
implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
implementation("io.quarkus:quarkus-hibernate-validator")
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-rest-client-reactive-jackson")
implementation("io.quarkus:quarkus-reactive-pg-client")
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
implementation("io.quarkus:quarkus-hibernate-reactive")

runtimeOnly("io.quarkus:quarkus-container-image-jib")
runtimeOnly("io.quarkus:quarkus-micrometer-registry-prometheus")

And application.yml file:

quarkus:
  vault:
    authentication:
      app-role:
        role-id: ${quarkus.application.name}-role-id
        secret-id: ${quarkus.application.name}-secret-id
    url: http://vault:8200
    secret-config-kv-path: ${quarkus.application.name}
    health:
      enabled: true
    credentials-provider:
      postgres:
        credentials-role: ${quarkus.application.name}
        credentials-mount: postgres
  datasource:
    db-kind: postgresql
    jdbc: false
    credentials-provider: postgres
    reactive:
      url: vertx-reactive:postgresql://postgres:5432/${quarkus.application.name}
  hibernate-orm:
    database:
      generation: update

Interesting fact is that I can manually get credentials for postgres mount, via Postman, yet it seems that this call is never performed by Vault in Quarkus.

Also, when I replace the credentials provider with username and password, everything works well.

Would you see any issues in my setup?

Thanks!
Michal

@Michal-Kucera
Copy link
Author

Screenshot from my investigation:

image

@jkalex-git
Copy link

This issue started showing up from "quarkus.platform.version" Quarkus 2.12.0.Final.
It works perfectly fine with Quarkus 2.11.2.Final.

jbride added a commit to redhat-na-ssa/keycloak_customizations_quickstart that referenced this issue Dec 2, 2022
Unable to enable vault credentials provider for pgsql database due to: quarkiverse/quarkus-vault#78
@cescoffier
Copy link
Contributor

@geoand @mkouba any idea?

@geoand
Copy link
Contributor

geoand commented Feb 1, 2023

I'll have a look tomorrow

@cescoffier
Copy link
Contributor

Actually.... the reporter opened another (different) issue: #99

@geoand
Copy link
Contributor

geoand commented Feb 2, 2023

So we have multiple problems?

@cescoffier
Copy link
Contributor

Looks like it...

@geoand
Copy link
Contributor

geoand commented Feb 2, 2023

I'll have a look

@geoand
Copy link
Contributor

geoand commented Feb 2, 2023

I think I have found the problem - it seems to be a Quarkus issue

@Michal-Kucera
Copy link
Author

Thanks for looking at it folks! Please do let me know if I can help in any way

@geoand
Copy link
Contributor

geoand commented Feb 2, 2023

This turns out to be more complex than I thought...

Essentially the problem is that when creating the synthetic bean for the PgPool, Quarkus loads the CredentialsProvider (via CDI) which then attempts (in this case) to load Vertx from CDI. This last load will fail because Vertx is also a synthetic bean.

The way I see it, we only have two options, neither of which is pretty:

  1. @mkouba gives us a way to access Vertx from a synthetic bean being created (because although Vertx is a synthetic bean, it is guaranteed to be initialized by this point)
  2. We introduce a new method to CredentialsProvider interface, something like:
public interface CredentialsProvider {

    Map<String, String> getCredentials(Input input);

    interface Input {
        
        String credentialsProviderName();
        
        Vertx vertx();
    }
}

We could make this new method a default method that returns an empty map and update the Javadoc of CredentialsProvider that the new method should be implemented when access to Vertx is needed.

P.S. Cases like show why we should almost always use this Input style pattern as it allows for updating an SPI without breaking (or in this case adding awkard new methods) existing code.

@raffaelespazzoli
Copy link

simple repro
vault-issue-repro.zip

@geoand
Copy link
Contributor

geoand commented Feb 6, 2023

@cescoffier @mkouba WDYT about what I mentioned in my previous comment?

geoand added a commit to geoand/quarkus-vault that referenced this issue Feb 6, 2023
This is needed because the VertxVaultClient can potentially
be used inside a Synthetic bean and in such cases
obtaining Vertx which is itself a synthetic bean is
not possible

Fixes: quarkiverse#78
@geoand
Copy link
Contributor

geoand commented Feb 6, 2023

Actually, #109 should work around the issue.

It's a hack obviously :)

@mkouba
Copy link
Contributor

mkouba commented Feb 6, 2023

All synthetic RUNTIME_INIT beans are initialized in one go during SyntheticBeansProcessor.initRuntime() and RUNTIME_INIT recorders that use these beans should @Consume(SyntheticBeansRuntimeInitBuildItem.class). Which is not possible here because of a cyclic dependency.

Just to sum it up: a synthetic bean for PgPool is initialized in the PgPoolRecorder.configurePgPool() method where the VaultCredentialsProvider bean is looked up; and VaultCredentialsProvider injects the VaultDynamicCredentialsManager that injects a VaultClient that is produced by the SharedVertxVaultClient.createSharedVaultClient() producer method that looks up the SharedVertxVaultClient which injects the Vertx synthetic bean and this bean not initialized yet 😰.

We cannot use lazy bean loading here because the CredentialsProvider.getCredentials() must be called. We probably also can't initialize the SharedVertxVaultClient.webClient lazily and inject the Instance<Vertx> instead...

@kdubb kdubb closed this as completed in #109 Feb 8, 2023
kdubb added a commit that referenced this issue Feb 8, 2023
Avoid obtaining Vertx from CDI
kdubb pushed a commit that referenced this issue Feb 8, 2023
This is needed because the VertxVaultClient can potentially
be used inside a Synthetic bean and in such cases
obtaining Vertx which is itself a synthetic bean is
not possible

Fixes: #78
@raffaelespazzoli
Copy link

@kdubb could you cut a release with this fix?

@ingmarfjolla
Copy link

ingmarfjolla commented Feb 15, 2023

did this fix the error? I just tried using the extension with the repro and get the same error. I also cloned this repo and built + used my local maven instead of pulling the extension so I'm not sure if the fix worked

@kdubb
Copy link
Contributor

kdubb commented Feb 15, 2023

Did you test with the snapshot version generated from the repo?

@ingmarfjolla
Copy link

ah, using the snapshot I get a different error:

[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 3 deployment problems: 
[1] Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
[2] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
[3] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
      at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1231)
      at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
      at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
      at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
      at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
      at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      at java.base/java.lang.Thread.run(Thread.java:829)
      at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:449)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:449)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more

      at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
      at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
      at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
      at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:86)
      at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:447)
      at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:59)
      at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
      at io.quarkus.bootstrap.app.Cueption: Build failure: Build failed due to errorspplication.java:104)
      [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 3 deployment problems: 
[1] Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
[2] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
[3] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
      at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1231)
      at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
      at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
      at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
      at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
      at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      at java.base/java.lang.Thread.run(Thread.java:829)
      at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:449)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:449)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more

      at io.quarkus.builder.Execution.run(Execution.java:123)
      at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
      at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
      at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
      ... 9 more
Caused by: javax.enterprise.inject.spi.DeploymentException: Found 3 deployment problems: 
[1] Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
[2] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.crtxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
[3] Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
      at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1231)
      at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
      at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
      at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
      at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
      at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      at java.base/java.lang.Thread.run(Thread.java:829)
      at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.vault.VaultPKISecretReactiveEngine and qualifiers [@Default]
      - java member: io.quarkus.vault.VaultPKISecretEngine():engine
      - declared on CLASS bean [types=[io.quarkus.vault.VaultPKISecretEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.VaultPKISecretEngine]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultKvManager():vaultClient
      - declared on CLASS bean [types=[io.quarkus.vault.runtime.VaultKvManager, io.quarkus.vault.VaultKVSecretReactiveEngine, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultKvManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.SharedVertxVaultClient]
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, java.lang.Object, io.quarkus.vault.runtime.client.PrivateVertxVaultClient], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.client.PrivateVertxVaultClient]
              at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:449)
              at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
              at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
              ... 13 more
      Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type io.quarkus.vault.runtime.client.VaultClient and qualifiers [@Default]
      - java member: io.quarkus.vault.runtime.VaultDynamicCredentialsManager():vaultClient
      - declared on CLASS bean [types=[java.lang.Object, io.quarkus.vault.runtime.VaultDynamicCredentialsManager], qualifiers=[@Default, @Any], target=io.quarkus.vault.runtime.VaultDynamicCredentialsManager]
      - available beans:
              - CLASS bean [types=[io.quarkus.vault.runtime.client.VertxVaultClient, io.quarkus.vault.runtime.client.VaultClient, io.quarkus.vault.runtime.client.SharedVertxVaultClient, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.vault.runti

@geoand
Copy link
Contributor

geoand commented Feb 16, 2023

Do you have a sample project we can look at?

@ingmarfjolla
Copy link

I was using the vault-issue-repro that @raffaelespazzoli attached above

@kdubb
Copy link
Contributor

kdubb commented Feb 21, 2023

@raffaelespazzoli What do I need to do to test with your repro project?

When I run with the fix applied I get this error

VaultClientException{operationName='VAULT [CREDENTIALS] Generate', requestPath='/v1/database/creds/mydbrole', status=404, body='{"errors":["no handler for route \"database/creds/mydbrole\". route entry not found."]}

This at least tells me that Vault is being called properly but I'd let to get a successful test before I call it fixed.

@kdubb
Copy link
Contributor

kdubb commented Feb 21, 2023

Obviously the Vault instance isn't initialized properly. Have you got an init script?

The extension supports initializing a DevServices instance using quarkus.vault.devservices.init-commands
Can you add the required initialization to the application.properties or inject the VaultClient and initialize the DevServices instance on application startup?

@ingmarfjolla
Copy link

ingmarfjolla commented Feb 22, 2023

@kdubb I have another sort of repro here: https://github.com/ingmarfjolla/quarkus-reactive/tree/main/reactivequarkusorderservice that just fails on startup with the same original error (I also upgraded to Quarkus 3.0) :

jakarta.enterprise.inject.CreationException: Synthetic bean instance for io.vertx.core.Vertx not initialized yet: io_vertx_core_Vertx_97d170e1550eee4afc0af065b78cda302a97674c
        - a synthetic bean initialized during RUNTIME_INIT must not be accessed during STATIC_INIT
        - RUNTIME_INIT build steps that require access to synthetic beans initialized during RUNTIME_INIT should consume the SyntheticBeansRuntimeInitBuildItem

to start the app I just do quarkus dev or you can do ./gradlew quarkusDev

@raffaelespazzoli
Copy link

we verified that this fix works with a local build, can we get a release containing this fix? @kdubb

@kdubb
Copy link
Contributor

kdubb commented Mar 10, 2023

@raffaelespazzoli I will get something out this weekend.

@kdubb
Copy link
Contributor

kdubb commented Mar 10, 2023

Great news BTW!

@geoand
Copy link
Contributor

geoand commented Mar 10, 2023

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants