EDIT: As answered below by Carlos, this was a bug with serverless-dynamodb-local version 0.2.23 (version as of this edit is 0.2.35). It has now been resolved and if you are experiencing a similar issue you should update your dependencies.
I had a working dev environment of an AWS Lambda function developed on the Serverless framework, using DynamoDB (plugins: serverless-offline, serverless-dynamodb-local . After deleting node_modules and reinstalling, I have lost the ability to start the development server, which I used to do with serverless offline start
serverless offline
works properly, but if I try to run dynamodb locally it throws the following error:
Reference Error ----------------------------------------
options is not defined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
ReferenceError: options is not defined
at BbPromise.resolve.then (/Users/pablo/Documents/myProject/node_modules/serverless-dynamodb-local/index.js:164:21)
From previous event:
at PluginManager.invoke (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/classes/PluginManager.js:236:22)
at PluginManager.run (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/classes/PluginManager.js:255:17)
at variables.populateService.then (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at Serverless.run (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/bin/serverless:39:50)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 6.10.3
Serverless Version: 1.19.0
Oddly enough, if I go to localhost:8000/shell, the dynamodb shell is running.
has anyone had a similar problem?
I tried the below and it resolved the issue for me
Reference https://github.com/99xt/serverless-dynamodb-local/issues/210
So it turns it was an issue, registered and solved here: https://github.com/99xt/serverless-dynamodb-local/issues/120
You can download the version 0.2.24 by typing
npm i serverless-dynamodb-local@0.2.24 --save-dev
if you are using it as a development dependency.First, add Serverless Offline to your project:
Then inside your project's
serverless.ym
l file add following entry to the plugins section:serverless-offline
. If there is no plugin section you will need to add it to the file.It should look something like this:
You can check wether you have successfully installed the plugin by running the serverless command line:
the console should display Offline as one of the plugins now available in your Serverless project.
then In your project root run:
Reference link