Micronaut 3.1.3 Documentation
Micronaut and Google Cloud Function
Running the function locally
./mvnw function:run
And visit http://localhost:8080/functionExample
Deploying the function
First build the function with:
$ ./mvnw clean package
Then cd
into the target
directory (deployment has to be done from the location where the JAR lives):
$ cd target
Now run:
$ gcloud functions deploy function-example --entry-point io.micronaut.gcp.function.http.HttpFunction --runtime java11 --trigger-http
Choose unauthenticated access if you don't need auth.
To obtain the trigger URL do the following:
$ YOUR_HTTP_TRIGGER_URL=$(gcloud functions describe function-example --format='value(httpsTrigger.url)')
You can then use this variable to test the function invocation:
$ curl -i $YOUR_HTTP_TRIGGER_URL/functionExample