quarkusio/quarkus · error · IllegalStateException

DynamoDB records are too specific. It is not supported to ex

Error message

DynamoDB records are too specific. It is not supported to extract a message from them. Use the DynamodbStreamRecord in your funq method, or use EventBridge Pipes with CloudEvents.

What it means

The EventBridge Pipes DynamoDB event handler likewise refuses to extract a generic message body from a DynamoDB stream record; getBody always throws IllegalStateException with guidance to use DynamodbStreamRecord as the funq parameter or CloudEvents via Pipes.

Source

Thrown at extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/event/dynamodb/PipesDynamoDbEventHandler.java:32

public class PipesDynamoDbEventHandler
        implements EventHandler<List<DynamodbStreamRecord>, DynamodbStreamRecord, StreamsEventResponse> {

    @Override
    public Stream<DynamodbStreamRecord> streamEvent(List<DynamodbStreamRecord> event, FunqyAmazonConfig amazonConfig) {
        if (event == null) {
            return Stream.empty();
        }
        return event.stream();
    }

    @Override
    public String getIdentifier(DynamodbStreamRecord message, FunqyAmazonConfig amazonConfig) {
        return message.getDynamodb().getSequenceNumber();
    }

    @Override
    public Supplier<InputStream> getBody(DynamodbStreamRecord message, FunqyAmazonConfig amazonConfig) {
        throw new IllegalStateException("""
                DynamoDB records are too specific. It is not supported to extract a message from them. \
                Use the DynamodbStreamRecord in your funq method, or use EventBridge Pipes with CloudEvents.
                """);
    }

    @Override
    public StreamsEventResponse createResponse(List<String> failures, FunqyAmazonConfig amazonConfig) {
        if (!amazonConfig.advancedEventHandling().dynamoDb().reportBatchItemFailures()) {
            return null;
        }
        return StreamsEventResponse.builder().withBatchItemFailures(
                failures.stream().map(id -> StreamsEventResponse.BatchItemFailure.builder()
                        .withItemIdentifier(id).build()).toList())
                .build();
    }

    @Override
    public Class<DynamodbStreamRecord> getMessageClass() {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Change the funq method parameter to DynamodbStreamRecord
  2. Or transform records to CloudEvents in the Pipes configuration and consume CloudEvent input
  3. Or configure a Pipes filter/enrichment so the delivered payload matches a generic JSON shape

Example fix

// before
public void fun(String json) { ... }
// after
public void fun(DynamodbStreamRecord record) { ... }
Defensive patterns

Strategy: type-guard

Validate before calling

// ensure the funq parameter type matches the Pipes source
if (record instanceof DynamodbStreamRecord) {
    process(record);
}

Type guard

boolean isDynamoRecord(Object evt) {
    return evt instanceof DynamodbStreamRecord;
}

Try / catch

try {
    return handler.getBody(message, config);
} catch (IllegalStateException e) {
    // switch to DynamodbStreamRecord or CloudEvents handling
}

Prevention

When it happens

Trigger: A funq method receiving a DynamoDB stream record through EventBridge Pipes declares a generic input type; getBody is called and always throws.

Common situations: Using EventBridge Pipes sourced from DynamoDB Streams while the function signature still expects String/POJO input; copying a handler class and forgetting DynamoDB records need the specific type.

Related errors


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