Skip to content

CreateTable fails with "Expected integer, got string" against strict DynamoDB endpoints (Ministack) #518

Description

@bojanraic

Bug

Table creation via the UI fails against strict DynamoDB-compatible endpoints (MiniStack, etc.) with:

Expected integer, got string: 3
Deserialization error: to see the raw response, inspect the hidden field $response on this object.

Root cause

In lib/routes.ts, ReadCapacityUnits and WriteCapacityUnits are destructured from req.body.TableDefinition. Express body-parser delivers all form values as strings. These are passed directly to the SDK without conversion:

// routes.ts ~160
await ddbApi.createTable({
    TableName,
    ProvisionedThroughput: {
        ReadCapacityUnits,   // "3": string, not number
        WriteCapacityUnits,  // "3": string, not number
    },
    ...
});

Strict DynamoDB servers reject the string values with a ValidationException. AWS SDK v3 then fails to deserialize that error response, producing the confusing message above.

Looks like TableDefinitionInput has no BillingMode field, so ProvisionedThroughput is always sent - there is no way to avoid this path from the UI.

The same issue affects GSI throughput at the secondary index loop (lines ~150–151).

Fix

ProvisionedThroughput: {
    ReadCapacityUnits: Number(ReadCapacityUnits),
    WriteCapacityUnits: Number(WriteCapacityUnits),
},

Same fix for the GSI path:

ProvisionedThroughput: {
    ReadCapacityUnits: Number(secondaryIndex.ReadCapacityUnits),
    WriteCapacityUnits: Number(secondaryIndex.WriteCapacityUnits),
},

Steps to reproduce

  1. Run dynamodb-admin pointed at a strict DynamoDB-compatible endpoint (LocalStack, MiniStack, etc.)
  2. Open the "Create Table" dialog, fill in table name and key
  3. Submit - error is shown regardless of the capacity values entered

Versions

  • dynamodb-admin: 5.2.0
  • @aws-sdk/client-dynamodb: 3.693.0
  • Endpoint: MiniStack 1.3.33

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions