Describe the bug
I created a maven project according to this guide:
https://github.com/quarkusio/quarkus/blob/master/docs/src/main/asciidoc/amazon-lambda.adoc
And got an error when I tried bash ./invoke-native.sh
Expected behavior
out file is like following when I created the function with invoke.sh.
{"result":"hello Bill","requestId":"1434f808-f8c4-4d8c-a507-fe4464273e6e"}
Actual behavior
out file is:
{"errorType":"Runtime.ExitError","errorMessage":"RequestId: 6b8192ad-5a30-4efa-a3e1-2905cfe5542e Error: &{0xc000092240 map[invoke_id:6b8192ad-5a30-4efa-a3e1-2905cfe5542e sandbox_id:0] 2019-11-08 17:40:39.511112521 +0000 UTC m=+0.070780883 panic <nil> Runtime failed to start: fork/exec /var/task/bootstrap: exec format error <nil> }"}
To Reproduce
Steps to reproduce the behavior:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
mvn archetype:generate -DarchetypeGroupId=io.quarkus -DarchetypeArtifactId=quarkus-amazon-lambda-archetype -DarchetypeVersion=1.0.0.CR1 and edit create-native.sh's IAM Role ARN.mvn clean install -Dnative and bash ./create-native.shbash ./invoke-native.sh shows errorSTART RequestId: 09c77434-b332-4f21-bfd4-686636bf9f54 Version: $LATEST
END RequestId: 09c77434-b332-4f21-bfd4-686636bf9f54
REPORT RequestId: 09c77434-b332-4f21-bfd4-686636bf9f54 Duration: 92.68 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 13 MB
RequestId: 09c77434-b332-4f21-bfd4-686636bf9f54 Error: &{0xc00005e2a0 map[invoke_id:09c77434-b332-4f21-bfd4-686636bf9f54 sandbox_id:0] 2019-11-08 18:09:38.736065039 +0000 UTC m=+0.047690988 panic <nil> Runtime failed to start: fork/exec /var/task/bootstrap: exec format error <nil> }
Runtime.ExitError
Configuration
quarkus.lambda.handler=test
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a or ver: Darwin kdnakt.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64java -version: openjdk version "11.0.2" 2019-01-15Additional context
(Add any other context about the problem here.)
The project is here: https://github.com/kdnakt/quarkus-lambda-sample
(Though lambda role arn is not modified)
+1
Output of java -version: openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
@kdnakt, Does it work if you use Java 8 instead of Java 11?
@jaikiran I have the same problem with Java 8:
% java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
Eclipse OpenJ9 VM (build openj9-0.17.0, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20191017_369 (JIT enabled, AOT enabled)
OpenJ9 - 77c1cf708
OMR - 20db4fbc
JCL - 97b5ec8f383 based on jdk8u232-b09)
Having looked around a bit, it looks like in this case, either or both of you are building this native image on MacOS and then running it on Linux VM perhaps?
Can one you try using this command to build the native image locally:
mvn clean install -Dnative -Dquarkus.native.container-build=true
This should generate the native image within a container and you can then use the create-native.sh and invoke-native.sh as usual to try out the AWS function.
More details on generating a native-build through a container can be found here https://quarkus.io/guides/maven-tooling#build-a-container-friendly-executable
thanks @jaikiran - it works now!
@goranopacic Thank you for confirming. I'll close this now.
@jaikiran Thanks for your advice, I just confirmed it worked with Java11 following your advice!
Also, thank you for @goranopacic trying with Java8.
Most helpful comment
Having looked around a bit, it looks like in this case, either or both of you are building this native image on MacOS and then running it on Linux VM perhaps?
Can one you try using this command to build the native image locally:
This should generate the native image within a container and you can then use the
create-native.shandinvoke-native.shas usual to try out the AWS function.More details on generating a native-build through a container can be found here https://quarkus.io/guides/maven-tooling#build-a-container-friendly-executable