@Table({ name: "storefront", clientConfig: { region: "us-east-1" } })
abstract class Storefront extends DynaRecord {}
@Table({
name: "storefront",
client: DynamoDBDocumentClient.from(new DynamoDBClient({ region: "us-east-1" }))
})
abstract class Storefront extends DynaRecord {}
Decorators evaluate at module load, before application bootstrap runs, so a client built during startup is not available here. Delegate to it instead:
@Table({
name: "storefront",
client: { send: command => getClient().send(command) }
})
abstract class Storefront extends DynaRecord {}
How a table reaches DynamoDB.
Supply neither option and dyna-record constructs a client with the AWS SDK's default resolution: region from
AWS_REGION/AWS_DEFAULT_REGIONor the shared config profile, credentials from the provider chain, and endpoint fromAWS_ENDPOINT_URL_DYNAMODB/AWS_ENDPOINT_URL— which is all a local DynamoDB needs.The two options are mutually exclusive:
clientConfigconfigures the client dyna-record constructs,clientreplaces it.