Skip to content

Instantly share code, notes, and snippets.

@0xBABA
Created October 27, 2020 12:47
Show Gist options
  • Save 0xBABA/1fc4eb4e4ea1a2273392b52320ecfb84 to your computer and use it in GitHub Desktop.
Save 0xBABA/1fc4eb4e4ea1a2273392b52320ecfb84 to your computer and use it in GitHub Desktop.
jest-dynamodb connection error
const isTest = process.env.JEST_WORKER_ID;
const options = {
convertEmptyValues: true,
...(isTest && {
endpoint: 'localhost:8000',
sslEnabled: false,
region: 'local-env',
}),
};
const documentClient = new AWS.DynamoDB.DocumentClient(options);
// ...
module.exports = {
tables: [
{
TableName: 'AqDataTable-dev',
BillingMode: 'PAY_PER_REQUEST',
AttributeDefinitions: [
{
AttributeName: 'device_id',
AttributeType: 'S',
},
{
AttributeName: 'timestamp',
AttributeType: 'N',
},
{
AttributeName: 'org',
AttributeType: 'S',
},
],
KeySchema: [
{
AttributeName: 'device_id',
KeyType: 'HASH',
},
{
AttributeName: 'timestamp',
KeyType: 'RANGE',
},
],
},
],
port: 8000,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment