Skip to content

Tier 3: oversize batch and transact requests emit non-conforming validation messages #18

@hicksy

Description

@hicksy

Summary

Over-limit batch and transact requests emit messages that don't match the standard 1 validation error detected: ... envelope DynamoDB returns. Two distinct shapes diverge.

Version: dynoxide 0.9.9

Cases

BatchGetItem (> 100 keys) and BatchWriteItem (> 25 requests)

Tests:

  • tests/tier3/error-messages/batchGetItem.test.ts "> 100 keys across all tables: interpolated full error"
  • tests/tier3/error-messages/batchWriteItem.test.ts "> 25 requests: anchored regex on the constraint phrase"

Expected (BatchGetItem, exact):

1 validation error detected: Value at 'RequestItems.<table>.member.Keys' failed to satisfy constraint: Member must have length less than or equal to 100

Expected (BatchWriteItem, anchored regex around the Java-toString dump):

^1 validation error detected: Value '\{<table>=\[.+\]\}' at 'requestItems' failed to satisfy constraint: Map value must satisfy constraint: \[Member must have length less than or equal to 25, Member must have length greater than or equal to 1\]$

Actual (both):

Too many items requested for the BatchGetItem call
Too many items requested for the BatchWriteItem call

TransactGetItems (> 100 gets) and TransactWriteItems (> 100 actions)

Tests:

  • tests/tier3/error-messages/transactGetItems.test.ts "> 100 gets: anchored regex on the constraint phrase"
  • tests/tier3/error-messages/transactWriteItems.test.ts "> 100 actions: anchored regex on the constraint phrase"

Expected (anchored regex around the dump, both ops):

^1 validation error detected: Value '\[.+\]' at 'transactItems' failed to satisfy constraint: Member must have length less than or equal to 100$

Actual (both):

Member must have length less than or equal to 100

The constraint phrase is correct, but the 1 validation error detected: Value '...' at 'transactItems' failed to satisfy constraint: prefix is missing.

Reproduction

npx dynoxide@0.9.9 --port 8001 &
node -e '
import("@aws-sdk/client-dynamodb").then(async ({ DynamoDBClient, CreateTableCommand, BatchGetItemCommand, BatchWriteItemCommand, TransactGetItemsCommand, TransactWriteItemsCommand }) => {
  const c = new DynamoDBClient({ endpoint: "http://localhost:8001", region: "us-east-1", credentials: { accessKeyId: "f", secretAccessKey: "f" } });
  const t = "t" + Date.now();
  await c.send(new CreateTableCommand({ TableName: t, AttributeDefinitions: [{ AttributeName: "pk", AttributeType: "S" }], KeySchema: [{ AttributeName: "pk", KeyType: "HASH" }], BillingMode: "PAY_PER_REQUEST" }));
  const keys = Array.from({ length: 101 }, (_, i) => ({ pk: { S: `k-${i}` } }));
  const writes = Array.from({ length: 26 }, (_, i) => ({ PutRequest: { Item: { pk: { S: `w-${i}` } } } }));
  const tgets = Array.from({ length: 101 }, (_, i) => ({ Get: { TableName: t, Key: { pk: { S: `tg-${i}` } } } }));
  const tputs = Array.from({ length: 101 }, (_, i) => ({ Put: { TableName: t, Item: { pk: { S: `tw-${i}` } } } }));
  for (const cmd of [
    new BatchGetItemCommand({ RequestItems: { [t]: { Keys: keys } } }),
    new BatchWriteItemCommand({ RequestItems: { [t]: writes } }),
    new TransactGetItemsCommand({ TransactItems: tgets }),
    new TransactWriteItemsCommand({ TransactItems: tputs }),
  ]) {
    try { await c.send(cmd); }
    catch (e) { console.log(e.message); }
  }
});
'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv0.9.10

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions