anomalyco/sst · error · VisibleError

The provided ARN "${arn}" is not a DynamoDB table ARN.

Error message

The provided ARN "${arn}" is not a DynamoDB table ARN.

What it means

parseDynamoArn validates a DynamoDB table ARN (arn:aws:dynamodb:region:account-id:table/table-name) and extracts the table name. It throws a VisibleError when the string lacks 'arn:' or has no '/'-delimited table name.

Source

Thrown at platform/src/components/aws/helpers/arn.ts:65

export function parseQueueArn(arn: string) {
  // arn:aws:sqs:region:account-id:queue-name
  const [arnStr, , , region, accountId, queueName] = arn.split(":");
  if (arnStr !== "arn" || !queueName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not an SQS Queue ARN.`,
    );
  return {
    queueName,
    queueUrl: `https://sqs.${region}.amazonaws.com/${accountId}/${queueName}`,
  };
}

export function parseDynamoArn(arn: string) {
  // arn:aws:dynamodb:region:account-id:table/table-name
  const tableName = arn.split("/")[1];
  if (!arn.startsWith("arn:") || !tableName)
    throw new VisibleError(
      `The provided ARN "${arn}" is not a DynamoDB table ARN.`,
    );
  return { tableName };
}

export function parseDynamoStreamArn(streamArn: string) {
  // ie. "arn:aws:dynamodb:us-east-1:112233445566:table/MyTable/stream/2024-02-25T23:17:55.264"
  const parts = streamArn.split(":");
  const tableName = parts[5]?.split("/")[1];
  if (parts[0] !== "arn" || parts[2] !== "dynamodb" || !tableName)
    throw new VisibleError(
      `The provided ARN "${streamArn}" is not a DynamoDB stream ARN.`,
    );
  return { tableName };
}

export function parseKinesisStreamArn(streamArn: string) {
  // ie. "arn:aws:kinesis:us-east-1:123456789012:stream/MyStream";

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Use the full form arn:aws:dynamodb:region:account-id:table/table-name
  2. If you only have the table name, build the ARN with region and account ID
  3. For streams use parseDynamoStreamArn instead of parseDynamoArn

Example fix

// before
parseDynamoArn("my-table");
// after
parseDynamoArn("arn:aws:dynamodb:us-east-1:123456789012:table/my-table");
Defensive patterns

Strategy: validation

Validate before calling

const TABLE_ARN = /^arn:aws[a-zA-Z-]*:dynamodb:[^:]+:\d{12}:table\/[^/]+$/;
if (!TABLE_ARN.test(arn)) throw new Error(`Not a DynamoDB table ARN: ${arn}`);

Type guard

function isDynamoTableArn(v: string): boolean {
  return /^arn:aws[a-zA-Z-]*:dynamodb:[^:]+:\d{12}:table\/[^/]+$/.test(v);
}

Try / catch

try {
  const { tableName } = parseDynamoArn(arn);
} catch (e) {
  throw new Error(`Failed to parse DynamoDB table ARN "${arn}": ${(e as Error).message}`);
}

Prevention

When it happens

Trigger: Creating an AppSync data source from a table ARN where the string is a table name or a stream ARN without the table/table-name path.

Common situations: Passing just the table name, passing a stream ARN where a table ARN is expected, missing region/account segments.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/5f4047eecd884b18. Report an issue: GitHub.