micronaut-projects / micronaut-starter

Generates Micronaut applications
Apache License 2.0
211 stars 96 forks source link

Generated project template for Gradle, Kotlin, google-cloud-function (HTTP) results in a Not Found response for the /hello path #338

Closed fwpascual closed 4 years ago

fwpascual commented 4 years ago

Thanks for reporting an issue, please review the task list below before submitting the issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

Steps to Reproduce

  1. From command line run mn create-app my-app --features google-cloud-function --lang kotlin
  2. Run ./gradlew runFunction
  3. Go to `http://localhost:8080/hello"

Expected Behaviour

Should see a message of "Example Response"

Actual Behaviour

Receive {"message":"Not Found","_links":{"self":{"href":"/hello","templated":false}}}

Environment Information

Example Application

N/A: Reproducible using unmodified CLI project

fwpascual commented 4 years ago

I found that if I alter the generated build.gradle file to better match what is shown here, that I can get the expected response.

Specifically, changing the runFunction task from

args(
            '--target', 'io.micronaut.gcp.function.http.HttpFunction',
            '--classpath', (configurations.runtimeClasspath + sourceSets.main.output).asPath,
            '--port', 8080
    )

to

args(
            '--target', 'io.micronaut.gcp.function.http.HttpFunction',
            '--port', 8080
    )
    doFirst {
        args('--classpath', files(configurations.runtimeClasspath, sourceSets.main.output).asPath)
    }