All skills
aws avatar

/aws-sdk-js-v3-usage

@c3ed514

AWS SDK for JavaScript v3 development patterns. Use when writing JavaScript or TypeScript code that uses AWS services via @aws-sdk/* packages (aws-sdk-js-v3), or when asked about schemas, runtime validation, serialization, or code generation in the context of the JS/TS AWS SDK.

Use this Skill: https://skilld.dev/gh/aws/agent-toolkit-for-aws/aws-sdk-js-v3-usage

This session only. Nothing lands on disk.

referenceserror-handling.md

≈417 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Error Handling Reference

Service Errors

Non-2xx responses are thrown as JavaScript Errors with SDK-specific fields:

try {
  await client.send(new CreateFunctionCommand({ ... }));
} catch (e) {
  if (e?.$metadata) {
    // e.name          — error code string (e.g. "ResourceNotFoundException")
    // e.$metadata.httpStatusCode — HTTP status
    // e.$response     — raw HTTP response object
    // e.$responseBodyText — set when SDK fails to parse the error body (unexpected format)
    console.error(e.name, e.$metadata.httpStatusCode);
  }
}

Checking Specific Error Types

By name or instanceof (both safe — SDK overrides Symbol.hasInstance):

import { NoSuchKeyException } from "@aws-sdk/client-s3";

if (e.name === "NoSuchKeyException") { ... }
if (e instanceof NoSuchKeyException) { ... }

Unparseable Error Bodies

If the error body can't be parsed (e.g. a proxy returned HTML), the message will say:

"Deserialization error: to see the raw response, inspect the hidden field {error}.$response"

Inspect with:

if (e.$responseBodyText) console.debug(e.$responseBodyText);

TypeScript: Version Mismatch Compilation Error

If you see:

error TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'
  'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype

This is caused by mismatched @smithy/types / @aws-sdk/types versions across clients. Fix by pinning all @aws-sdk/client-* packages to the same version range:

{
  "@aws-sdk/client-s3": "<=3.800.0",
  "@aws-sdk/client-dynamodb": "<=3.800.0"
}

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill is a comprehensive documentation resource for the AWS SDK for JavaScript v3. It provides development patterns, best practices for credential management, resource handling, and performance optimization using official AWS packages and repositories.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at c3ed514. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 5 months ago

README badge

README badge for aws/agent-toolkit-for-aws/aws-sdk-js-v3-usage