Git Product home page Git Product logo

serverless-dynamodb-local's Introduction

serverless-dynamodb-local

Join the chat at https://gitter.im/99xt/serverless-dynamodb-local npm version License: MIT

This Plugin Requires

  • serverless@^1
  • Java Runtime Engine (JRE) version 6.x or newer OR docker CLI client

Features

  • Install DynamoDB Local Java program
  • Run DynamoDB Local as Java program on the local host or in docker container
  • Start DynamoDB Local with all the parameters supported (e.g port, inMemory, sharedDb)
  • Table Creation for DynamoDB Local

Install Plugin

npm install --save serverless-dynamodb-local

Then in serverless.yml add following entry to the plugins array: serverless-dynamodb-local

plugins:
  - serverless-dynamodb-local

Using the Plugin

  1. Install DynamoDB Local (unless using docker setup, see below) sls dynamodb install

  2. Add DynamoDB Resource definitions to your Serverless configuration, as defined here: https://serverless.com/framework/docs/providers/aws/guide/resources/#configuration

  3. Start DynamoDB Local and migrate (DynamoDB will process incoming requests until you stop it. To stop DynamoDB, type Ctrl+C in the command prompt window). Make sure above command is executed before this. sls dynamodb start --migrate

Note: Read the detailed section for more information on advanced options and configurations. Open a browser and go to the url http://localhost:8000/shell to access the web shell for dynamodb local.

Install: sls dynamodb install

This installs the Java program locally. If using docker, this step is not required.

To remove the installed dynamodb local, run: sls dynamodb remove Note: This is useful if the sls dynamodb install failed in between to completely remove and install a new copy of DynamoDB local.

Start: sls dynamodb start

This starts the DynamoDB Local instance, either as a local Java program or, if the --docker flag is set, by running it within a docker container. The default is to run it as a local Java program.

All CLI options are optional:

--port  		  -p  Port to listen on. Default: 8000
--cors                    -c  Enable CORS support (cross-origin resource sharing) for JavaScript. You must provide a comma-separated "allow" list of specific domains. The default setting for -cors is an asterisk (*), which allows public access.
--inMemory                -i  DynamoDB; will run in memory, instead of using a database file. When you stop DynamoDB;, none of the data will be saved. Note that you cannot specify both -dbPath and -inMemory at once.
--dbPath                  -d  The directory where DynamoDB will write its database file. If you do not specify this option, the file will be written to the current directory. Note that you cannot specify both -dbPath and -inMemory at once. For the path, current working directory is <projectroot>/node_modules/serverless-dynamodb-local/dynamob. For example to create <projectroot>/node_modules/serverless-dynamodb-local/dynamob/<mypath> you should specify -d <mypath>/ or --dbPath <mypath>/ with a forwardslash at the end.
--sharedDb                -h  DynamoDB will use a single database file, instead of using separate files for each credential and region. If you specify -sharedDb, all DynamoDB clients will interact with the same set of tables regardless of their region and credential configuration.
--delayTransientStatuses  -t  Causes DynamoDB to introduce delays for certain operations. DynamoDB can perform some tasks almost instantaneously, such as create/update/delete operations on tables and indexes; however, the actual DynamoDB service requires more time for these tasks. Setting this parameter helps DynamoDB simulate the behavior of the Amazon DynamoDB web service more closely. (Currently, this parameter introduces delays only for global secondary indexes that are in either CREATING or DELETING status.)
--optimizeDbBeforeStartup -o  Optimizes the underlying database tables before starting up DynamoDB on your computer. You must also specify -dbPath when you use this parameter.
--migration               -m  After starting dynamodb local, run dynamodb migrations.
--heapInitial                 The initial heap size
--heapMax                     The maximum heap size
--migrate                 -m  After starting DynamoDB local, create DynamoDB tables from the Serverless configuration.
--seed                    -s  After starting and migrating dynamodb local, injects seed data into your tables. The --seed option determines which data categories to onload.
--convertEmptyValues      -e  Set to true if you would like the document client to convert empty values (0-length strings, binary buffers, and sets) to be converted to NULL types when persisting to DynamoDB.
--docker                      Run DynamoDB inside docker container instead of as a local Java program
--dockerImage                 Specify custom docker image. Default: amazon/dynamodb-local

All the above options can be added to serverless.yml to set default configuration: e.g.

custom:
  dynamodb:
  # If you only want to use DynamoDB Local in some stages, declare them here
    stages:
      - dev
    start:
      port: 8000
      inMemory: true
      heapInitial: 200m
      heapMax: 1g
      migrate: true
      seed: true
      convertEmptyValues: true
    # Uncomment only if you already have a DynamoDB running locally
    # noStart: true

Docker setup:

custom:
  dynamodb:
  # If you only want to use DynamoDB Local in some stages, declare them here
    stages:
      - dev
    start:
      docker: true
      port: 8000
      inMemory: true
      migrate: true
      seed: true
      convertEmptyValues: true
    # Uncomment only if you already have a DynamoDB running locally
    # noStart: true

Migrations: sls dynamodb migrate

Configuration

In serverless.yml add following to execute all the migration upon DynamoDB Local Start

custom:
  dynamodb:
    start:
      migrate: true

AWS::DynamoDB::Table Resource Template for serverless.yml

resources:
  Resources:
    usersTable:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: usersTable
        AttributeDefinitions:
          - AttributeName: email
            AttributeType: S
        KeySchema:
          - AttributeName: email
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1

Note: DynamoDB local doesn't support TTL specification, therefore plugin will simply ignore ttl configuration from Cloudformation template.

Seeding: sls dynamodb seed

Configuration

In serverless.yml seeding categories are defined under dynamodb.seed.

If dynamodb.start.seed is true, then seeding is performed after table migrations.

If you wish to use raw AWS AttributeValues to specify your seed data instead of Javascript types then simply change the variable of any such json files from sources: to rawsources:.

custom:
  dynamodb:
    start:
      seed: true

    seed:
      domain:
        sources:
          - table: domain-widgets
            sources: [./domainWidgets.json]
          - table: domain-fidgets
            sources: [./domainFidgets.json]
      test:
        sources:
          - table: users
            rawsources: [./fake-test-users.json]
          - table: subscriptions
            sources: [./fake-test-subscriptions.json]
> sls dynamodb seed --seed=domain,test
> sls dynamodb start --seed=domain,test

If seed config is set to true, your configuration will be seeded automatically on startup. You can also put the seed to false to prevent initial seeding to use manual seeding via cli.

[
  {
    "id": "John",
    "name": "Doe",
  },
]

Using DynamoDB Local in your code

You need to add the following parameters to the AWS NODE SDK dynamodb constructor

e.g. for dynamodb document client sdk

var AWS = require('aws-sdk');
new AWS.DynamoDB.DocumentClient({
    region: 'localhost',
    endpoint: 'http://localhost:8000',
    accessKeyId: 'DEFAULT_ACCESS_KEY',  // needed if you don't have aws credentials at all in env
    secretAccessKey: 'DEFAULT_SECRET' // needed if you don't have aws credentials at all in env
})

e.g. for dynamodb document client sdk

new AWS.DynamoDB({
    region: 'localhost',
    endpoint: 'http://localhost:8000',
    accessKeyId: 'DEFAULT_ACCESS_KEY',  // needed if you don't have aws credentials at all in env
    secretAccessKey: 'DEFAULT_SECRET' // needed if you don't have aws credentials at all in env

})

Using with serverless-offline plugin

When using this plugin with serverless-offline, it is difficult to use above syntax since the code should use DynamoDB Local for development, and use DynamoDB Online after provisioning in AWS. Therefore we suggest you to use serverless-dynamodb-client plugin in your code.

The serverless dynamodb start command can be triggered automatically when using serverless-offline plugin. Please note that you still need to install DynamoDB Local first.

Add both plugins to your serverless.yml file:

plugins:
  - serverless-dynamodb-local
  - serverless-offline

Make sure that serverless-dynamodb-local is above serverless-offline so it will be loaded earlier.

Now your local DynamoDB database will be automatically started before running serverless offline.

Using with serverless-offline and serverless-webpack plugin

Run serverless offline start. In comparison with serverless offline, the start command will fire an init and a end lifecycle hook which is needed for serverless-offline and serverless-dynamodb-local to switch off both ressources.

Add plugins to your serverless.yml file:

plugins:
  - serverless-webpack
  - serverless-dynamodb-local
  - serverless-offline #serverless-offline needs to be last in the list

Reference Project

Links

License

MIT

serverless-dynamodb-local's People

Contributors

alexzelenuyk avatar aneilbaboo avatar ashanfernando avatar charithsoori avatar danbovey avatar darthtrevino avatar gevorggalstyan avatar gwincr11 avatar isuruab avatar jslowack avatar keshav1002 avatar lakindu95 avatar miltador avatar mjmrz avatar mjzone avatar msjonker avatar mvayngrib avatar nenti avatar nevon avatar popsail avatar raducoti avatar rehrumesh avatar remicastaing avatar sgrowe avatar shalithasuranga avatar terencenero007 avatar valdemon avatar vkarponen avatar wferr avatar whatif-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-dynamodb-local's Issues

Implement support to store seed scripts

Implement support to store data seed scripts so that, when dynamodb starts it is possible to run the commands and seed the database table automatically

Note: It will require another configuration parameter to be added to plugins custom configuration area which is added in s-project.json file, to get the seed scripts root location, and a template to define the data so that it can be run individually or as a batch with

sls dynamodb table -n <table_name> // Create template
sls dynamodb table -c // Create the table and run seeds

Consider restructuring as a Lerna monorepo

The DynamoDB tooling you guys have written is very useful, but it's spread out over half a dozen packages, and in my experience projects like that can be hard to keep in sync. The monorepo style has been used a lot recently, and it may be a great fit here. You still maintain package-level modularity for the individual tools, but you can pull development tasks (linting, testing), to the top level project, test everything as a complete system, and automate npm-linking of inter-package dependencies.

Stage functionality has changed

Stage used to be prepended to the table name, since the latest NPM update this is has changed:

Input:

sls dynamodb start -s local

Old output:

Dynamodb Local Started, Visit: http://localhost:8000/shell

Table creation completed for table: local-databaseName

New output:

Dynamodb Local Started, Visit: http://localhost:8000/shell

Table creation completed for table: -databaseName

Is it intended or a bug?

If intended how do I set a stage in my dynamodb names?

Doesnt seem to ignore VIM .swp files

It seems that running migrations via sls dynamodb executeAll runs all files within /dynamodb regardless of whether they are .json extensions or not.

It may be useful to ignore non-json files.

image

image

Spec:

  • serverless v1
  • serverless-dynamodb-local v1

Steps to Reproduce:

  • create migration file using sls dynamodb create -n <filename>
  • open file using VIM or create .<filename>.json.swp
  • run sls dynamodb executeAll

Expose `--host` for docker-compose support

If we have dynamodb-local running as a docker container and compose the services with docker-compose, we'd still like to use this package for the migrate functionality.
However, in a docker-compose scenario, dynamodb-local runs on a separate host and for this to work, this package would need to expose a --host option.

Is this something you'd consider exposing?

Add the plugin to npm registry

After building the basic plugin, add the plugin to npm registry, so that others can install it using
npm install serverless-dynamodb-local

Error "sls dynamodb install"

When I ran sls dynamodb install an error message appeared as shown below.

Full stack trace:

[Error: Error getting DynamoDb local latest tar.gz location: 200]
/home/vagrant/aws-serverless-prototype/node_modules/dynamodb-localhost/dynamodb/installer.js:43
                    throw Error("Error in downloading Dynamodb local " + err);
                    ^

Error: Error in downloading Dynamodb local Error: connect ECONNREFUSED 127.0.0.1:80
    at Error (native)
    at ClientRequest.<anonymous> (/home/vagrant/aws-serverless-prototype/node_modules/dynamodb-localhost/dynamodb/installer.js:43:27)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:269:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1269:8)
    at nextTickCallbackWith2Args (node.js:458:9)
    at process._tickDomainCallback (node.js:413:17)

My operating environment is as follows.

  • HostOS
    • MacOS Sierra 10.12.3
  • GuestOS(Vagrant 1.8.7 + VirtualBOX 5.1.12)
    • CentOS Linux release 7.3.1611 (Core)
  • Node.js(v4.7.2)
  • serverless(1.5.1)
  • serverless-dynamodb-local(0.2.16)

I did a bit of node_modules/dynamodb-localhost/dynamodb/installer.js debugging.

I could download from the URL stored in the variable "downloadUrl" on line 11 using curl.

$ curl -L -O -kv http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to dynamodb-local.s3-website-us-west-2.amazonaws.com port 80 (#0)
*   Trying 52.218.144.91...
* Connected to dynamodb-local.s3-website-us-west-2.amazonaws.com (52.218.144.91) port 80 (#0)
> GET /dynamodb_local_latest.tar.gz HTTP/1.1
> User-Agent: curl/7.29.0
> Host: dynamodb-local.s3-website-us-west-2.amazonaws.com
> Accept: */*
>
< HTTP/1.1 200 OK
< x-amz-id-2: I1DQB9usvczdpC6MXBB09f7rnkCHHEei4+QLjsI21YxluUraUfpYfU80ooIOWsadH3E7eKm+/z4=
< x-amz-request-id: 49C3FA2E3E3AADD0
< Date: Sun, 29 Jan 2017 12:25:40 GMT
< Last-Modified: Wed, 18 Jan 2017 18:26:45 GMT
< x-amz-version-id: wRzlbckhjnZIm0CVgcmTkkgmHBAB9l_U
< ETag: "c7c1bacf57b840022927f67d1a4b8e46"
< Content-Type: application/x-gzip
< Content-Length: 44203144
< Server: AmazonS3
<
{ [data not shown]
100 42.1M  100 42.1M    0     0  6133k      0  0:00:07  0:00:07 --:--:-- 8229k
* Connection #0 to host dynamodb-local.s3-website-us-west-2.amazonaws.com left intact

However, the contents of response.headers.location passed to http.get () on line 16 was undefined.

Cannot read property 'dynamodb' of null

I installed the 1.0 branch following instructions, but saw this error when trying to run sls dyanmodb start

  Type Error ---------------------------------------------

     Cannot read property 'dynamodb' of undefined

     For debugging logs, run again after setting SLS_DEBUG env var.

Debugging shows it comes from this line. I was able to get past the error by adding this to my serverless.yml file

custom:
  dynamodb:

I'm a serverless noob - is it just a matter of updating the 1.0 branch README to reference serverless.yml instead of s-project.json?

"Dynamodb start" missing log4j/logger - exception

Console output:

>sls dynamodb start
Dynamodb Local Started, Visit: http://localhost:8000/shell

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer.<clinit>(DynamoDBProxyServer.java:36)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServer(ServerRunner.java:123)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServerFromCommandLineArgs(ServerRunner.java:119)
        at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.main(ServerRunner.java:70)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 4 more
DynamoDB Local failed to start with code 1

Versions:

>sls --v
1.5.1

>java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

>node -v
v7.2.0

Package.json:

   "serverless-dynamodb-local": "^0.2.16",
    "serverless-offline": "^3.8.3"

serverless.yaml

service: aws-nodejs-nexit

provider:
  name: aws
  runtime: nodejs4.3
functions:
  hello:
    handler: src/handler.hello
    events:
      - http:
          path: hello
          method: get
plugins:
  - serverless-offline
  - serverless-dynamodb-local

custom:
  dynamodb:
    start:
      port: 8000
      inMemory: true
      migration: true
    migration:
      dir: ./offline/migrations

Implement configuration options to set dynamodb local download path

Implement configuration options to set dynamodb local download path. currently its inside a variable of a function of dynamodb/db.js and it is not configurable. This task is to provide a configuration option in s-project.json where, a user can override the default download path if needed to use any version of dynamodb local plugin

Missing ExecuteAll? Won't migrate...

Hey!

So, somehow my version of dynamoDB local is now missing the executeALL function? It's also refusing to load the migrations when I start the utility.

custom:
  dynamodb:
    start:
      port: 8001
      inMemory: true
      migration: true
    migration:
      table_prefix: ${opt:stage}
      dir: ./dynamolocal/migrations

The stage variable is set to local.

Help!

Error with Seeds

The seeds field on a provision file cannot be omitted or else you get this error:

Unhandled rejection TypeError: Cannot read property 'map' of undefined

You cannot create an empty array or else you get this error:

ValidationException: The batch write request list for a table cannot be null or empty: products

Suggest code checks for a seeds array before running dynamodb-migrations on https://github.com/99xt/serverless-dynamodb-local/blob/master/index.js#L193

Rely on docker for local dynamodb

Could this plugin switch to relying on docker or better yet docker-compose so I would have to have blobal JDK installation for DynamoDB?

Replace 'Q' js promises with 'bluebird' promises

Currently inside the dynamodb/* plugin code, it uses 'Q' promises (require('q')) to include Promises to the code. Since serverless is already using 'blubird' for Promises which is more capable than 'Q' and to keep the uniformity of promises, this tasks scope is to remove 'Q' promises and replace with 'bluebird' promises and remove, the dependency for 'Q' in package.json

Serverless Offline hangs on quit

When quitting a serverless offline session, it looks like the plugin attempts to restart DyanmoDB Local. This hangs the process indefinitely.

Console output:

^CServerless: Serverless Halting...
DynamoDB Local failed to start with code 130

serverless.yml:

plugins:
  - serverless-offline
  - serverless-dynamodb-local

custom:
  dynamodb:
    start:
      port: 8000
      inMemory: true
      migrate: true

Version 0.2.19

Refactor the plugin code

Currently the plugin code is full of, auto generated code form the plugin boiler plate. These unnecessary code needs to be removed and cleaned up from the plugin code

Working with Resources declaration

Wouldn't it be better if this plugin would work with Resources section from Serverless v.1 ?

That way I wouldn't have to define them twice in yml and in json for this plugin.

Implement support to store table creation scripts

Implement support to store table creation scripts so that, when dynamodb starts it is possible to run the commands and create the database table automatically

Note: It will require another configuration parameter to be added to plugins custom configuration area which is added in s-project.json file, to get the table creation scripts root location, and a template to define the data so that it can be run individually or as a batch with

sls dynamodb tables init -n 'name'
sls dynamodb tables init --a (which means create all)

and to create table creation template
sls dynamodb tables create -n 'name' (name of the function)

Replace console.log with serverless SCLI logs

Replace console.log with serverless SCLI logs
e.g
SCli = require(S.getServerlessPath('utils/cli'));
SCli.log('Successfully pruned the following functions in the following regions: ');

Any serverless v1.0 support

I think the community is shifting towards serverless v1.0. Any support on that or do we have to use the native dynamodb local by aws?

Error Installing Dynamodb

I get the following errors when trying to install dynamodb on my local machine and my travis builds.

Local Machine:

Error: Error getting DynamoDb local latest tar.gz location: 200
    at ClientRequest.<anonymous> (/Users/tony/git/pathway-server/node_modules/dynamodb-localhost/dynamodb/installer.js:14:26)
    at ClientRequest.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
    at Socket.socketOnData (_http_client.js:363:20)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)
/Users/tony/git/pathway-server/node_modules/dynamodb-localhost/dynamodb/installer.js:43
                    throw Error("Error in downloading Dynamodb local " + err);
                    ^

Error: Error in downloading Dynamodb local Error: connect ECONNREFUSED 127.0.0.1:80
    at Error (native)
    at ClientRequest.<anonymous> (/Users/tony/git/pathway-server/node_modules/dynamodb-localhost/dynamodb/installer.js:43:27)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1276:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

Travis-CI:

Error: Error in downloading Dynamodb local Error: connect ECONNREFUSED 127.0.0.1:80
    at Error (native)
    at ClientRequest.<anonymous> (/home/travis/build/ProlifiqSoftware/pathway-server/node_modules/serverless-dynamodb-local/node_modules/dynamodb-localhost/dynamodb/installer.js:43:27)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:256:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1255:8)
    at nextTickCallbackWith2Args (node.js:437:9)
    at process._tickDomainCallback (node.js:392:17)

dbPath property is not working

I think dbPath property needs to be set to default working_direcetory.

As a feature the seed should be exportable from the current database.

Publish to NPM

The current code state is not published to NPM. It took me a while to figure out why tables where not being created ๐Ÿ˜• Ends up that the published version is out of date. Could you update to NPM please?

Allowing to configure optional parameter as configuration

First implementation is to support all the optional parameters to be given as parameters when executing serverless commands related with the plugin. However it is difficult to type and run if there are multiple parameters are set. This task is to provide the capability for users to implement support to configure these parameters also in s-project.js custom configuration field provided for plugins

Add a parameter to install command, so that if it is already installed it won't reinstall

Running the sls dynamodb install command downloads and installs the dynamodb-local every time even if it is already installed.
It would be nice to have a parameter ( --no-reinstall ?) , in which case the install command would first check if dynamodb-local is installed, and if it is return straight away.

This would help usage of serverless-dynamodb-local in different automation scenarios.

Profile support

We need support for multiple profiles, currently it is using the default profile.

TypeError: Cannot read property 'dynamodb' of undefined

I followed the instructions to install plugin, declare in "plugins" section of serverless.yml, and install with sls dynamodb install.
when i run sls dynamodb start I get the error in the title, at /Users/overlord/Dev/Trails4.0/serverless/node_modules/serverless-dynamodb-local/index.js:211:45

here's what that line looks like in context:
startHandler() { let self = this, options = this.options; return new BbPromise(function(resolve) { let config = self.service.custom.dynamodb, options = _.merge({ sharedDb: self.options.sharedDb || true }, self.options, config && config.start

Any ideas on how to make this work?

Seeding Buffer value doesn't work

If I try to seed something like this:

{
 "name":"test",
 "email":"[email protected]",
 "salt": {
     "type":"Buffer",
     "data":[118,71,177,248,110,54,84,149,174,240,32,125,83,151,113,196]
 },
 "encryptedPassword":"LCmT7j986FbGDHdX92Y0OfeQr0bfozI4XbCwDeLuEl/RHTF/Q==",
 "id":"6c56f4e0-1e29-11e7-b5a1-d9397b6b601c",
}

saltwon't be seeded as Buffer value but as json object.

Implement other commands for dynamodb

Currently only sls dynamodb launch is only implemented. Implement the following commands

  • stop
  • relaunch
    Note: the basic logic for these functions are already implemented in dynamodb/db.js. The need is to create custom actions in root/index.js and call the relevant functions

NPM version is outdated

A new NPM version needs to be released. The version installed via NPM doesn't include the dummy-credentials and offline support, which results in an error like this when trying to run:

sls dynamodb executeAll
{ TimeoutError: Missing credentials in config
    at ClientRequest.<anonymous> (/Users/invisibletotoro/Documents/Development/GitHub/StashCloud/Stash/node_modules/aws-sdk/lib/http/node.js:56:34)
    at ClientRequest.g (events.js:291:16)
    at emitNone (events.js:86:13)
    at ClientRequest.emit (events.js:185:7)
    at Socket.emitTimeout (_http_client.js:620:10)
    at Socket.g (events.js:291:16)
    at emitNone (events.js:86:13)
    at Socket.emit (events.js:185:7)
    at Socket._onTimeout (net.js:339:8)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
  message: 'Missing credentials in config',
  code: 'CredentialsError',
  time: 2017-01-18T04:05:18.168Z,
  retryable: true,
  originalError: 
   { message: 'Could not load credentials from any providers',
     code: 'CredentialsError',
     time: 2017-01-18T04:05:18.168Z,
     retryable: true,
     originalError: 
      { message: 'Connection timed out after 1000ms',
        code: 'TimeoutError',
        time: 2017-01-18T04:05:18.166Z,
        retryable: true } } }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.