@novominteractive/serverless-dynamodb-local-streams v0.2.3
Serverless DynamoDB Local Streams
Serverless plugin to use DynamoDBStreams locally using serverless-offline and DynamoDBLocal
master is unsafe, please refer to tags.
Usage
Setup
Add the plugin to your serverless configuration file.
This plugin requires the serverless-dynamodb and serverless-offline plugins to work. These plugins can be installed using:
yarn add -D serverless-dynamodb serverless-offline
and install the plugin with
yarn add -D @novominteractive/serverless-dynamodb-local-streams
example with a serverless.ts:
const config: AWS = {
// ...
plugins: [
'serverless-dynamodb',// Must be after this one
'@novominteractive/serverless-dynamodb-local-streams', // <-- Add this
'serverless-offline', // But before this one
],
// ...
};And add the plugin configuration. The options are passed to the DynamoDBClient and DynamoDBStreamsClient. See those for available options.
const config: AWS = {
// ...
custom: {
'@novominteractive/serverless-dynamodb-local-streams': {
apiVersion: '2013-12-02',
endpoint: 'http://0.0.0.0:8000',
region: 'ca-central-1',
accessKeyId: 'MockAccessKeyId',
secretAccessKey: 'MockSecretAccessKey',
skipCacheInvalidation: false,
},
},
// ...
};That's it! Now a mocked implementation of DynamoDBStreams will invoke your lambdas according to your configuration.
Caveats
- This a mocked implementation of DynamoDBStreams, it is a good simulation for development but is not 100% accurate to how the real service functions.
- For example, the service will queue records if the lambda throws an error while processing them. It is not the case for this implementation, they will be dropped after 10 retries with 500ms between retries.
Prerequisites
Getting Started
- From the project's root directory, run
yarnto install dependencies - Enjoy!
Development
This project uses the Typescript language for type-checking.
Contributing
Never commit directly on master, instead use branches and pull requests.
Once approved, a Pull request is merged in master by its author. Also, it must be squashed before merging,
either manually or using GitHub's Squash and merge feature.
You must use the following Style Guides :
This project contains a linting config, you should setup eslint into your IDE with .eslintrc.js.