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

Regression: SRCFG00011: Could not expand value exception #27377

Closed
knutwannheden opened this issue Aug 19, 2022 · 7 comments · Fixed by #27576
Closed

Regression: SRCFG00011: Could not expand value exception #27377

knutwannheden opened this issue Aug 19, 2022 · 7 comments · Fixed by #27576
Assignees
Labels
Milestone

Comments

@knutwannheden
Copy link
Contributor

Describe the bug

There appears to be a regression in Quarkus 2.12.0.CR1 in the area of SmallRye Config.

I have a simple application which only uses quarkus-resteasy-reactive and quarkus-security and the following application.properties file:

quarkus.http.auth.permission.quarkus.paths=${quarkus.http.non-application-root-path}/*
quarkus.http.auth.permission.quarkus.policy=devops
quarkus.http.auth.policy.devops.roles-allowed=DEVOPS

When starting up the application it fails with an exception with the following root cause:

Caused by: java.util.NoSuchElementException: SRCFG00011: Could not expand value quarkus.http.non-application-root-path in property quarkus.http.auth.permission.quarkus.paths
	at io.smallrye.config.ExpressionConfigSourceInterceptor$1.accept(ExpressionConfigSourceInterceptor.java:68)
	at io.smallrye.config.ExpressionConfigSourceInterceptor$1.accept(ExpressionConfigSourceInterceptor.java:58)
	at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22)
	at io.smallrye.common.expression.CompositeNode.emit(CompositeNode.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:58)
	at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:38)
	at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
	at io.smallrye.config.FallbackConfigSourceInterceptor.getValue(FallbackConfigSourceInterceptor.java:24)
	at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
	at io.smallrye.config.PropertyNamesConfigSourceInterceptor.getValue(PropertyNamesConfigSourceInterceptor.java:17)
	at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20)
	at io.smallrye.config.SmallRyeConfig.getConfigValue(SmallRyeConfig.java:307)
	at io.quarkus.runtime.configuration.ConfigRecorder.handleConfigChange(ConfigRecorder.java:40)
	at io.quarkus.deployment.steps.ConfigGenerationBuildStep$checkForBuildTimeConfigChange1532146938.deploy_4(Unknown Source)
	at io.quarkus.deployment.steps.ConfigGenerationBuildStep$checkForBuildTimeConfigChange1532146938.deploy(Unknown Source)
	... 52 more

So somehow the value in the quarkus.http.auth.permission.quarkus.paths=${quarkus.http.non-application-root-path}/* cannot be expanded. In all earlier versions of Quarkus this worked.

Expected behavior

It seems like this should be allowed.

Actual behavior

Exception thrown at startup (see issue description).

How to Reproduce?

Reproduce:

  1. Download and extract code-with-quarkus.zip
  2. Run mvn verify or mvn quarkus:dev
  3. See logged exception

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

2.12.0.CR1

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

No response

Additional information

No response

@knutwannheden knutwannheden added the kind/bug Something isn't working label Aug 19, 2022
@knutwannheden
Copy link
Contributor Author

/cc @radcortez

@gsmet gsmet added this to the 2.12.0.Final milestone Aug 19, 2022
@gsmet gsmet removed this from the 2.12.0.Final milestone Aug 24, 2022
@gsmet
Copy link
Member

gsmet commented Aug 24, 2022

Roberto is on PTO for now so this will have to wait for 2.12.1.Final.

@knutwannheden
Copy link
Contributor Author

I assume the regression is related to the recent PR #26802. But this also got me thinking if a properties file (like application.properties or microprofile-config.properties) is allowed to refer to a build-time property (using property expansion) in the value for a runtime property. I think this should definitely work in the case of build-time properties defined in the scope of a @ConfigRoot(phase = BUILD_AND_RUN_TIME_FIXED) root, but what about roots with @ConfigRoot(phase = BUILD_TIME)? I think even the latter should be allowed, since the properties file was already provided at build-time, but that would also require some processing at build-time, which I don't know if Quarkus already does or not.

@gsmet
Copy link
Member

gsmet commented Aug 29, 2022

@knutwannheden could you have a look at #27576 ?

@radcortez
Copy link
Member

I think this should definitely work in the case of build-time properties defined in the scope of a @ConfigRoot(phase = BUILD_AND_RUN_TIME_FIXED) root,

This works since we need to resolve the value for extensions, and we need to write the resolved value for runtime to make sure it is not changed.

but what about roots with @ConfigRoot(phase = BUILD_TIME)? I think even the latter should be allowed, since the properties file was already provided at build-time, but that would also require some processing at build-time, which I don't know if Quarkus already does or not.

We don't support this, and I think it doesn't make sense. If we allow build time properties to be used to expand runtime properties, then there will be no difference between both, and users would be able to reference either. This will probably confuse users on why build time properties changes do not have any effect.

@knutwannheden
Copy link
Contributor Author

@knutwannheden could you have a look at #27576 ?

I will take a look and report back tomorrow.

We don't support this, and I think it doesn't make sense. If we allow build time properties to be used to expand runtime properties, then there will be no difference between both, and users would be able to reference either. This will probably confuse users on why build time properties changes do not have any effect.

There would still be a small difference: If a runtime property value is already supplied at build-time, then it would be able to refer to build-time properties. If the value is supplied at run-time, then not. But I agree that this may be confusing and I have until now never run into the need for this feature.

@knutwannheden
Copy link
Contributor Author

@gsmet I quickly tested my reproducer against the branch and I can confirm that the PR fixes the bug.

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