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

Config value evaluation failing when the placeholder value is missing #20618

Closed
cescoffier opened this issue Oct 8, 2021 · 4 comments · Fixed by #20632
Closed

Config value evaluation failing when the placeholder value is missing #20618

cescoffier opened this issue Oct 8, 2021 · 4 comments · Fixed by #20632
Assignees
Labels
Milestone

Comments

@cescoffier
Copy link
Member

Describe the bug

In an application using kubernetes-config, I have a prod profile with the following configuration:

%prod.quarkus.kubernetes-config.secrets=postgresql
%prod.quarkus.kubernetes-config.secrets.enabled=true
%prod.quarkus.datasource.db-kind=postgresql
%prod.quarkus.datasource.username=${database-user}
%prod.quarkus.datasource.password=${database-password}
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgresql:5432/person

The database-user and database-password are provided by a Kubernetes secret at runtime.
However, a simple mvn package throws:

java.util.NoSuchElementException: SRCFG00011: Could not expand value database-user in property quarkus.datasource.username
	at io.smallrye.config.ExpressionConfigSourceInterceptor.lambda$getValue$0(ExpressionConfigSourceInterceptor.java:63)
	at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22)
	at io.smallrye.common.expression.Expression.evaluateException(Expression.java:56)
	at io.smallrye.common.expression.Expression.evaluate(Expression.java:70)
	at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:56)
	at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:36)
	at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
	at io.smallrye.config.PropertyNamesConfigSourceInterceptor.getValue(PropertyNamesConfigSourceInterceptor.java:61)
	at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
	at io.smallrye.config.SmallRyeConfig.getConfigValue(SmallRyeConfig.java:307)
	at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:225)
	at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:324)
	at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.devServicesAutoGenerateByDefault(HibernateOrmProcessor.java:199)

Expected behavior

It should not fail.

Actual behavior

It fails since 2.3.0.

How to Reproduce?

Clone https://github.com/cescoffier/devnation-quarkus-movies and update the quarkus version to 999-SNAPSHOT (it fails since 2.3.0.Final), and run mvn package -DskipTests. You can revert to the original version to see the build succeeds.

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@cescoffier cescoffier added the kind/bug Something isn't working label Oct 8, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Oct 8, 2021

/cc @geoand, @iocanel

@cescoffier
Copy link
Member Author

/cc @radcortez

@radcortez
Copy link
Member

I'll have a look.

@radcortez
Copy link
Member

This seems to be caused by 19566de.

During build, we compile with the prod profile. That code is trying to see if the config is present, but that also tries to expand the value. I think we should be able to rewrite it so it doesn't try to expand it.

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

Successfully merging a pull request may close this issue.

3 participants