Git Product home page Git Product logo

aws-samples / aws-quarkus-demo Goto Github PK

View Code? Open in Web Editor NEW
71.0 6.0 24.0 1.58 MB

Quarkus example projects for Amazon ECS and Amazon EKS with AWS Fargate and AWS Lambda

Home Page: https://aws.amazon.com/blogs/architecture/field-notes-optimize-your-java-application-for-amazon-ecs-with-quarkus/

License: Apache License 2.0

JavaScript 2.81% TypeScript 24.20% Java 62.88% HTML 9.73% Shell 0.38%
aws-fargate cdk quarkusio eks amazon-ecs aws-lambda quarkus sam

aws-quarkus-demo's Issues

Lambda: Local SAM test fails with native image, but works with jvm

Hi there,

I'm running on Windows and used the following command to build the native image:

mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true

I was following the instructions on the README to test out the native lambda, but after starting the API with SAM:

sam local start-api --template sam.native.yaml

Mounting LambdaQuarkusFunction at http://127.0.0.1:3000/users/{userId} [DELETE, GET]
Mounting LambdaQuarkusFunction at http://127.0.0.1:3000/users [GET, POST]
You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2021-09-21 20:48:54  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)

I get the following output when using curl to try and add users:

Invoking not.used.in.provided.runtime (provided)
Decompressing C:\projects\aws-quarkus-demo\lambda\target\function.zip
Image was not found.
Removing rapid images for repo public.ecr.aws/sam/emulation-provided
Building image...................................................................................................................................................................................................................................................................................................................................................................................................................................
Skip pulling image and use local one: public.ecr.aws/sam/emulation-provided:rapid-1.31.0.

Mounting C:\Users\walte\AppData\Local\Temp\tmphkldv0kj as /var/task:ro,delegated inside runtime container
START RequestId: ef61cd3f-2adf-41d4-9a42-63c2dd58b7b2 Version: $LATEST
: No such file or directory
time="2021-09-21T19:50:11.625" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 127"
time="2021-09-21T19:50:11.626" level=error msg="INIT DONE failed: Runtime.ExitError"
Invalid lambda response received: Lambda response must be valid json
2021-09-21 20:50:12 127.0.0.1 - - [21/Sep/2021 20:50:12] "←[35m←[1mPOST /users HTTP/1.1←[0m" 502 -

When building the non-native image, everything works fine:

C:\projects\aws-quarkus-demo\lambda>sam --debug local start-api --template sam.jvm.yaml
Mounting LambdaQuarkusFunction at http://127.0.0.1:3000/users/{userId} [DELETE, GET]
Mounting LambdaQuarkusFunction at http://127.0.0.1:3000/users [GET, POST]
You can now browse to the above endpoints to invoke your functions. You do not need to restart/reload SAM CLI while working on your functions, changes will be reflected instantly/automatically. You only need to restart SAM CLI if you update your AWS SAM template
2021-09-21 22:22:20  * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)
Invoking io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest (java11)
Decompressing C:\projects\aws-quarkus-demo\lambda\target\function.zip
Skip pulling image and use local one: public.ecr.aws/sam/emulation-java11:rapid-1.31.0.

Mounting C:\Users\walte\AppData\Local\Temp\tmp8btgzah0 as /var/task:ro,delegated inside runtime container
START RequestId: c386af1e-00ab-4b3b-912a-cc05d2ea2bc8 Version: $LATEST
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2021-09-21 21:22:38,650 INFO  [io.quarkus] (main) LambdaQuarkus 1.1-SNAPSHOT on JVM (powered by Quarkus 2.0.0.Final) started in 9.184s.
2021-09-21 21:22:38,656 INFO  [io.quarkus] (main) Profile prod activated.
2021-09-21 21:22:38,657 INFO  [io.quarkus] (main) Installed features: [amazon-dynamodb, amazon-lambda, cdi]
2021-09-21 21:22:38,759 INFO  [com.ama.exa.ProcessingLambda] (main) [{resource: /users,path: /users,httpMethod: POST,headers: {Accept=*/*, Content-Length=69, Content-Type=application/json, Host=127.0.0.1:3000, User-Agent=curl/7.55.1, X-Forwarded-Port=3000, X-Forwarded-Proto=http},multiValueHeaders: {Accept=[*/*], Content-Length=[69], Content-Type=[application/json], Host=[127.0.0.1:3000], User-Agent=[curl/7.55.1], X-Forwarded-Port=[3000], X-Forwarded-Proto=[http]},requestContext: {accountId: 123456789012,resourceId: 123456,stage: prod,requestId: f18c7b05-ac94-4bb6-bdf3-f01a62513516,identity: {sourceIp: 127.0.0.1,userAgent: Custom User Agent String,},resourcePath: /users,httpMethod: POST,apiId: 1234567890,path: /users,},body: {"userName":"jdoe", "firstName":"John", "lastName":"Doe", "age":"35"},isBase64Encoded: false}] Processed data
2021-09-21 21:22:38,866 INFO  [com.ama.exa.ProcessingLambda] (main) POST: UserPojo{userId=cccc2e10-a068-4d70-9e8d-3bfc3cc4d444, userName='jdoe', firstName='John', lastName='Doe', age=35}
END RequestId: c386af1e-00ab-4b3b-912a-cc05d2ea2bc8
REPORT RequestId: c386af1e-00ab-4b3b-912a-cc05d2ea2bc8  Init Duration: 0.15 ms  Duration: 10752.64 ms   Billed Duration: 10800 ms       Memory Size: 512 MB     Max Memory Used: 512 MB
No Content-Type given. Defaulting to 'application/json'.
2021-09-21 22:22:39 127.0.0.1 - - [21/Sep/2021 22:22:39] "←[37mPOST /users HTTP/1.1←[0m" 200 -

Am I missing a step or is there a problem with the instructions?

Thanks
Walt

Maven wrapper not pushed?

./mvnw package -DskipTests
./mvnw: line 276: /home/ec2-user/aws-quarkus-demo/fargate/.mvn/wrapper/maven-wrapper.properties: No such file or directory
/home/ec2-user/aws-quarkus-demo/fargate/.mvn/wrapper/maven-wrapper.jar: No such file or directory
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.