question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lambda native does not work if it has dependency on quarkus-resteasy

See original GitHub issue

Describe the bug Following lambda guide works perfectly in native mode. But when adding dependency on io.quarkus:quarkus-resteasy it fails with java.lang.IllegalStateException: Failed to create cache dir at io.vertx.core.file.impl.FileResolver.setupCacheDir(FileResolver.java:332) at io.vertx.core.file.impl.FileResolver.<init>(FileResolver.java:87) at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:165)

Found this (already fixed) bug that provided workaroud with forcing java.tmpdir to /tmp. Hovever the official 1.0.0.Final guide (and maven archetype) does not use additional sh bootstrap file, but simply renames native executable to bootstrap. On the side note, local invocation of lambda function with AWS SAM framework works without problem.

Expected behavior Guide and archetype should provide valid infrormation.

To Reproduce Steps to reproduce the behavior:

  1. Create aws lambda project found here: https://quarkus.io/guides/amazon-lambda
  2. Add extension quarkus-resteasy to the project and create a resteasy service within the code.
  3. Build natively and upload to aws lambda.
  4. execute lambda function

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
louisbroscommented, Jan 5, 2020

I’m also facing this issue when using the quarkus-mailer with quarkus-amazon-lambda:

ERROR [io.qua.application] (main) Failed to start application: java.lang.IllegalStateException: Failed to create cache dir

Based on the information here, my solution was to:

  1. Update the zip.xml to rename bootstrap to runner:
<file>
    <source>${project.build.directory}${file.separator}${artifactId}-${version}-runner</source>
    <outputDirectory>/</outputDirectory>
    <destName>runner</destName>
    <fileMode>755</fileMode>
</file>
  1. Create a a new bootstrap.sh file to invoke the native runner with the java.io.tmpdir setting:
#!/bin/sh
./runner -Djava.io.tmpdir=/tmp
  1. Modify the zip.xml file to include the new bootstrap file:
<file>
    <source>${project.basedir}/src/assembly/bootstrap.sh</source>
    <outputDirectory>/</outputDirectory>
    <destName>bootstrap</destName>
    <fileMode>755</fileMode>
</file>
1reaction
mihapolakcommented, Dec 12, 2019

@evanchooly , I agree with you to use amazon lambda http. But I guess there are other components using vertx? @mehdi-reza, local sam invoke shows /var/tmp/ (if not changed with custom bootstrap file), which obviously works within local tests but not in case of actual aws deployment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon Lambda with RESTEasy Reactive, Undertow, or ...
If you are building native images, and want to use AWS X-Ray Tracing with your lambda you will need to include quarkus-amazon-lambda-xray as...
Read more >
Native Quarkus with AWS lambda does not build
In the non-working version of my code, I use a factory of com.amazon.ask.AlexaSkill that is somehow injected in the entry point, as follows:...
Read more >
Optimize your Java application for AWS Lambda with Quarkus
Quarkus is a framework that uses the Open Java Development Kit (OpenJDK) with GraalVM and over 50 libraries like RESTEasy, Vertx, Hibernate, ...
Read more >
Lambda native does not work if it has dependency on quarkus ...
Describe the bug. Following lambda guide works perfectly in native mode. But when adding dependency on io.quarkus:quarkus-resteasy it fails with java.lang.
Read more >
Amazon Lambda with RESTEasy, Undertow, or Vert.x Web
The AWS X-Ray library is not fully compatible with GraalVM so we had to do some integration work to make this work. Quarkus...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found