@QuarkusTest with quarkus-amazon-lambda-rest does not map REST resources paths and throws 404 for any call.
Describe the bug
Hello,
I use quarkus-amazon-lambda-rest extension and @QuarkusTest for e2e HTTP testing. Mostly because @QuarkusIntegrationTest does not support the aws lambdas. (see this )
After upgrading from Quarkus 3.21.1 to the latest LTE 3.27.1 my tests started failing. But REST endpoints do work in dev/prod modes. The tests worked fine before (even with failsafe plugin instead of surefire, now it fails with both)
Expected behavior
Rest assure tests must find defined endpoints
Actual behavior
Rest assure tests fail with 404.
How to Reproduce?
Use maven, java and below pom.xml
...
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.version>3.27.1</quarkus.platform.version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<!--
Using AWS SDK versions coherent with quarkus.
See https://github.com/quarkiverse/quarkus-amazon-services
-->
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-amazon-services-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
Test
@QuarkusTest
class HealthResourceTest {
@Inject
HealthCheckResource health; // injected just to be sure the resource is in the classpath/CDI/etc
@Test
void testStub() {
given()
.when().get("/svc/health/status") // "svc" is the "root path from `quarkus.http.root-path=${API_ROOT_PATH:/svc}`
.then()
.statusCode(200)
.body(is("OK"));
}
}
Resource
@Path("/health")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApplicationScoped
public class HealthCheckResource implements HealthCheckApi {
@GET
@Path("/status")
@Override
public String getStatus() {
return "OK";
}
}
rest module pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>svc-rest</artifactId>
<name>rest</name>
<parent>
<groupId>mygroup</groupId>
<artifactId>svc-parent</artifactId>
<version>${revision}${sha1}${changelist}</version>
</parent>
<dependencies>
<dependency>
<groupId>mygroup</groupId>
<!-- configs are shared in a sngle module -->
<artifactId>svc-config</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Quarkus rest lambda -->
<dependency>
<!-- Generates rest API handler lambda -->
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-lambda-rest</artifactId>
</dependency>
<dependency>
<!--
* If your application uses a client and exposes REST endpoints,
please use Quarkus REST for the server part.
* Please note that the quarkus-resteasy-client extension may not be used with Quarkus REST,
use quarkus-rest-client instead.
See https://quarkus.io/guides/rest-client
-->
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
</dependency>
<dependency>
<!-- Monitoring with x-ray events -->
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-lambda-xray</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Build quarkus bundle -->
<plugin>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.platform.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Output of uname -a or ver
Darwin Eugenes-Laptop.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:29:54 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8122 arm64
Output of java -version
openjdk version "22.0.2" 2024-07-16 OpenJDK Runtime Environment GraalVM CE 22.0.2+9.1 (build 22.0.2+9-jvmci-b01) OpenJDK 64-Bit Server VM GraalVM CE 22.0.2+9.1 (build 22.0.2+9-jvmci-b01, mixed mode, sharing)
Quarkus version or git rev
3.27.1
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.9.10 (5f519b97e944483d878815739f519b2eade0a91d) Maven home: /opt/homebrew/Cellar/maven/3.9.10/libexec Java version: 22.0.2, vendor: GraalVM Community, runtime: /Users/eugemak/Library/Java/JavaVirtualMachines/graalvm-ce-22.0.2/Contents/Home Default locale: en_LU, platform encoding: UTF-8 OS name: "mac os x", version: "15.6.1", arch: "x86_64", family: "mac"
Additional information
I'm aware about lambda + rest port conflicts (https://github.com/quarkusio/quarkus/issues/33312). It causes really weird no-responses/404/etc. I redirected the event server in my config quarkus.lambda.mock-event-server.test-port=8085. I see in the logs that the resource path and port are correct. (same one i use in dev mode)
/cc @patriot1burke (amazon-lambda)