quarkusio/quarkus · info · RuntimeException

should have comma

Error message

should have comma

What it means

GreetingResource.comma() is a CORS-related test endpoint in the amazon-lambda-http integration test. It requires the Access-Control-Request-Headers header to contain a comma; if the header is missing or has no comma it throws RuntimeException("should have comma"). It verifies that multi-value headers survive the API Gateway -> Lambda HTTP event mapping.

Source

Thrown at integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java:23

import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.MediaType;

import com.amazonaws.services.lambda.runtime.events.APIGatewayV2HTTPEvent;

@Path("/hello")
public class GreetingResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    @Path("comma")
    public String comma(@HeaderParam("Access-Control-Request-Headers") String access) {
        if (access == null || !access.contains(","))
            throw new RuntimeException("should have comma");
        return "ok";
    }

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }

    @POST
    @Produces(MediaType.TEXT_PLAIN)
    @Consumes(MediaType.TEXT_PLAIN)
    public String hello(String name) {
        return "hello " + name;
    }

    @POST
    @Produces(MediaType.APPLICATION_OCTET_STREAM)

View on GitHub (pinned to e1c734241f)

Solutions

  1. Send at least two values in Access-Control-Request-Headers, e.g. "content-type,authorization"
  2. Check API Gateway/payload format (v1 vs v2) configuration so multi-value headers are not collapsed
  3. Verify the client actually sends the CORS preflight header when hitting the endpoint

Example fix

// before
curl http://host/hello/comma -H "Access-Control-Request-Headers: content-type"   // fails
// after
curl http://host/hello/comma -H "Access-Control-Request-Headers: content-type,authorization"   // "ok"
Defensive patterns

Strategy: validation

Validate before calling

String access = request.getHeader("Access-Control-Request-Headers");
if (access == null || !access.contains(",")) {
    // request will be rejected — add a second header value before calling
}

Try / catch

try {
    String res = given().header("Access-Control-Request-Headers", "content-type,authorization").get("/hello/comma");
} catch (RuntimeException e) {
    if ("should have comma".equals(e.getMessage())) { /* fix headers */ }
}

Prevention

When it happens

Trigger: GET /hello/comma without an Access-Control-Request-Headers header, or with a single-value header containing no comma (e.g. "content-type" instead of "content-type,authorization").

Common situations: Testing CORS preflight header propagation through API Gateway; sending a preflight request with only one Access-Control-Request-Headers value; API Gateway or proxy stripping/collapsing multi-value headers.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/c8f5e00fb1afdc1e. Report an issue: GitHub.