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

[Bug] Since 1.11.3 problems reading application.yaml #15032

Closed
MartinX3 opened this issue Feb 12, 2021 · 5 comments · Fixed by #15045
Closed

[Bug] Since 1.11.3 problems reading application.yaml #15032

MartinX3 opened this issue Feb 12, 2021 · 5 comments · Fixed by #15045
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@MartinX3
Copy link

MartinX3 commented Feb 12, 2021

Describe the bug
Quarkus wants to populate a %prod variable while it is running in %dev
1.11.2 was fine
Now with 1.11.3 quarkus wants, that the env variables in %prod are valid while running in %dev

Expected behavior
Ignoring the missing environmental variable

Actual behavior
Could not expand value mail.pw in property %prod.quarkus.mailer.password"

To Reproduce

Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).

Or attach an archive containing the reproducer to the issue.

Steps to reproduce the behavior:

  1. Executing the application

Configuration

# Add your application.properties here, if applicable.
mp:
  openapi:
    scan:
      disable: true
quarkus:
  datasource:
    db-kind: postgresql
  hibernate-orm:
    database:
      generation: update
  http:
    root-path: /example-interface-v2/api/v2
"%dev":
  quarkus:
    datasource:
      jdbc:
        url: jdbc:postgresql://localhost:5432/TestDB
      password: benutzer
      username: benutzer
    hibernate-orm:
      database:
        generation: update # Duplicated code line to insert 'drop-and-create' if needed to import the import.sql
    log:
      min-level: DEBUG
      console:
        enable: true
        format: "%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n"
        color: true
        darken: 1
        json:
          pretty-print: true
    http:
      port: 8005
    mailer:
      from: [email protected]
      host: smtp.example.de
      password: ''
      port: 465
      ssl: true
      username: [email protected]
"%test":
  quarkus:
    datasource:
      db-kind: h2
      jdbc:
        url: jdbc:h2:mem:test
      password: example
      username: example
    hibernate-orm:
      database:
        generation: drop-and-create
    http:
      test-port: 8805
"%prod":
  quarkus:
    datasource:
      jdbc:
        url: jdbc:postgresql://${postgres.uri}:${postgres.port}/${postgres.db}
      password: ${postgres.password}
      username: ${postgres.user}
    http:
      port: 8082
    mailer:
      from: [email protected]
      host: smtp.example.de
      password: ${mail.pw}
      port: 465
      ssl: true
      username: [email protected]

Screenshots
N/A

Environment (please complete the following information):

  • Output of uname -a or ver:
    Linux example-linux 5.8.0-43-generic #49~20.04.1-Ubuntu SMP Fri Feb 5 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version:
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
  • Quarkus version or git rev: 1.11.3
  • Build tool (ie. output of mvnw --version or gradlew --version):
------------------------------------------------------------
Gradle 6.8
------------------------------------------------------------

Build time:   2021-01-08 16:38:46 UTC
Revision:     b7e82460c5373e194fb478a998c4fcfe7da53a7e

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.10 (Ubuntu 11.0.10+9-Ubuntu-0ubuntu1.20.04)
OS:           Linux 5.8.0-43-generic amd64

Additional context
If I remove the %prod section my application runs well in %dev mode
Stacktrace

{
    "timestamp": "2021-02-12T11:07:14.032+01:00",
    "sequence": 7490,
    "loggerClassName": "org.jboss.logging.Logger",
    "loggerName": "io.quarkus.runtime.Application",
    "level": "ERROR",
    "message": "Failed to start application (with profile dev)",
    "threadName": "Quarkus Main Thread",
    "threadId": 94,
    "mdc": {
    },
    "ndc": "",
    "hostName": "example-linux",
    "processName": "example-interface-backend-v2-dev.jar",
    "processId": 102797,
    "exception": {
        "refId": 1,
        "exceptionType": "java.util.NoSuchElementException",
        "message": "SRCFG00011: Could not expand value mail.pw in property %prod.quarkus.mailer.password",
        "frames": [
            {
                "class": "io.smallrye.config.ExpressionConfigSourceInterceptor",
                "method": "lambda$getValue$0",
                "line": 44
            },
            {
                "class": "io.smallrye.common.expression.ExpressionNode",
                "method": "emit",
                "line": 22
            },
            {
                "class": "io.smallrye.common.expression.Expression",
                "method": "evaluateException",
                "line": 56
            },
            {
                "class": "io.smallrye.common.expression.Expression",
                "method": "evaluate",
                "line": 70
            },
            {
                "class": "io.smallrye.config.ExpressionConfigSourceInterceptor",
                "method": "getValue",
                "line": 37
            },
            {
                "class": "io.smallrye.config.ExpressionConfigSourceInterceptor",
                "method": "getValue",
                "line": 18
            },
            {
                "class": "io.smallrye.config.SmallRyeConfigSourceInterceptorContext",
                "method": "proceed",
                "line": 20
            },
            {
                "class": "io.smallrye.config.SmallRyeConfig",
                "method": "getConfigValue",
                "line": 192
            },
            {
                "class": "io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsSupplier",
                "method": "get",
                "line": 44
            },
            {
                "class": "io.quarkus.vertx.http.runtime.devmode.ConfigDescriptionsSupplier",
                "method": "get",
                "line": 13
            },
            {
                "class": "io.quarkus.vertx.http.runtime.devmode.DevConsoleRecorder",
                "method": "addInfo",
                "line": 37
            },
            {
                "class": "io.quarkus.deployment.steps.DevConsoleProcessor$runtimeTemplates-308161071",
                "method": "deploy_9",
                "line": 21438
            },
            {
                "class": "io.quarkus.deployment.steps.DevConsoleProcessor$runtimeTemplates-308161071",
                "method": "deploy",
                "line": 85
            },
            {
                "class": "io.quarkus.runner.ApplicationImpl",
                "method": "doStart",
                "line": 872
            },
            {
                "class": "io.quarkus.runtime.Application",
                "method": "start",
                "line": 90
            },
            {
                "class": "io.quarkus.runtime.ApplicationLifecycleManager",
                "method": "run",
                "line": 97
            },
            {
                "class": "io.quarkus.runtime.Quarkus",
                "method": "run",
                "line": 66
            },
            {
                "class": "io.quarkus.runtime.Quarkus",
                "method": "run",
                "line": 42
            },
            {
                "class": "io.quarkus.runtime.Quarkus",
                "method": "run",
                "line": 119
            },
            {
                "class": "io.quarkus.runner.GeneratedMain",
                "method": "main",
                "line": 29
            },
            {
                "class": "jdk.internal.reflect.NativeMethodAccessorImpl",
                "method": "invoke0"
            },
            {
                "class": "jdk.internal.reflect.NativeMethodAccessorImpl",
                "method": "invoke",
                "line": 62
            },
            {
                "class": "jdk.internal.reflect.DelegatingMethodAccessorImpl",
                "method": "invoke",
                "line": 43
            },
            {
                "class": "java.lang.reflect.Method",
                "method": "invoke",
                "line": 566
            },
            {
                "class": "io.quarkus.runner.bootstrap.StartupActionImpl$3",
                "method": "run",
                "line": 134
            },
            {
                "class": "java.lang.Thread",
                "method": "run",
                "line": 834
            }
        ]
    }
}
@MartinX3 MartinX3 added the kind/bug Something isn't working label Feb 12, 2021
@ghost ghost added the area/kotlin label Feb 12, 2021
@ghost
Copy link

ghost commented Feb 12, 2021

/cc @evanchooly

@gsmet
Copy link
Member

gsmet commented Feb 12, 2021

@radcortez could it be related to your changes here: #14309 ?

@radcortez
Copy link
Member

Maybe, I'll check.

@radcortez
Copy link
Member

radcortez commented Feb 12, 2021

@MartinX3 Sorry about this.

This is related with some improvements for the console. Before we were only listing our own properties which was more controlled, now we list everything, including user ones and I guess I did not foresee all scenarios :)

As a workaround, you can set an empty default, like ${something:}. I already have a I fix for it to apply in the meanwhile. Thanks!

@MartinX3
Copy link
Author

Thank you, I set project specific empty env variables in my IntelliJ as a workaround. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants