marksailes / graalvm-on-lambda

GraalVM on Lambda resources
Apache License 2.0
15 stars 2 forks source link

Struggling with making this work on Apple Silicon (M1 Max) #1

Open stejsj opened 2 years ago

stejsj commented 2 years ago

Hi Mark

Thank you very much for your detailed information about graalvm on lambda and the code with cdk using docker to build a native image. When I run cdk deploy for graalvm-on-lambda/walkthrough/serverless-graalvm-arm64/infrastructure

I get this error in the lambda console when trying to call product route... the function build with graalvm.

START RequestId: ad65dc9b-f6d0-49d5-bd93-6ff92dd7b86e Version: $LATEST Failed to load the native runtime interface client library /aws-lambda-runtime-interface-client.glibc.so. Exception: Can't load library: /tmp/.aws-lambda-runtime-interface-client Failed to load the native runtime interface client library /aws-lambda-runtime-interface-client.musl.so. Exception: Can't load library: /tmp/.aws-lambda-runtime-interface-client Failed to load the native runtime interface client library /aws-lambda-runtime-interface-client.glibc.so. Exception: Can't load library: /tmp/.aws-lambda-runtime-interface-client Failed to load the native runtime interface client library /aws-lambda-runtime-interface-client.musl.so. Exception: Can't load library: /tmp/.aws-lambda-runtime-interface-client END RequestId: ad65dc9b-f6d0-49d5-bd93-6ff92dd7b86e REPORT RequestId: ad65dc9b-f6d0-49d5-bd93-6ff92dd7b86e Duration: 1144.37 ms Billed Duration: 1145 ms Memory Size: 256 MB Max Memory Used: 43 MB
RequestId: ad65dc9b-f6d0-49d5-bd93-6ff92dd7b86e Error: Runtime exited with error: exit status 255 Runtime.ExitError

I think I have tried almost everything possible, can you perhaps spot the issue?

Kind regards and thanx in advance! Steffen Egelund Jensen

dannylinden commented 2 years ago

Im facing the same issue. I build the binary in an ARM Docker Container on a Intel MacBook.

@stejsj could you find a solution in the meantime?

marksailes commented 2 years ago

Sorry for the slow response. The latest version of the aws-lambda-java-runtime-interface-client supports ARM.

<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-lambda-java-runtime-interface-client</artifactId>
    <version>2.1.1</version>
</dependency>

You will also need to update the resource-config.json to account for the path change.

https://github.com/aws-samples/serverless-graalvm-demo/blob/main/software/products/src/main/resources/META-INF/native-image/com.amazonaws/aws-lambda-java-runtime-interface-client/resource-config.json

https://github.com/aws-samples/serverless-graalvm-demo - has a complete working sample of these changes.