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 DynamoDB stream event handler for Funqy cannot extract a generic message body from a DynamoDB stream record because the record format is too specific. Instead of silently producing bad input, getBody always throws IllegalStateException directing you to consume DynamodbStreamRecord directly or route via EventBridge Pipes with CloudEvents.

Source

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

public class DynamoDbEventHandler implements EventHandler<DynamodbEvent, DynamodbStreamRecord, StreamsEventResponse> {

    @Override
    public Stream<DynamodbStreamRecord> streamEvent(DynamodbEvent event, FunqyAmazonConfig amazonConfig) {
        if (event == null) {
            return Stream.empty();
        }
        return event.getRecords().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 type to DynamodbStreamRecord
  2. Or put EventBridge Pipes between the DynamoDB stream and the Lambda and consume CloudEvents
  3. Or read the raw event type manually instead of relying on the generic binding

Example fix

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

Strategy: type-guard

Validate before calling

// guard before relying on generic body extraction
if (record instanceof DynamodbStreamRecord) {
    // handle via typed handler, never via generic getBody
}

Type guard

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

Try / catch

try {
    return handler.getBody(message, config);
} catch (IllegalStateException e) {
    // fall back to typed DynamodbStreamRecord handling
}

Prevention

When it happens

Trigger: A funq method bound to a DynamoDB stream trigger declares a generic parameter (String/POJO) instead of DynamodbStreamRecord; getBody is invoked when the Lambda receives a DynamoDB update event.

Common situations: Subscribing a Funqy function directly to a DynamoDB stream while expecting generic JSON input; migrating a function from another trigger type to DynamoDB streams without changing the method signature.

Related errors


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