serverless-dynamodb-local
serverless-dynamodb-local copied to clipboard
Plugin fails because of wrong installation path
Actual Behaviour
Plugin silently failing at installation
sls dynamodb install
Expected Behaviour
Some feedback when it fails.
Steps to reproduce it
- serverless
1.30.1
- macOS High Sierra
10.13.4
- Node
v7.2.1
$ serverless create --template aws-python3 --path python-dynamo-tmp
...
$ npm install --save serverless-dynamodb-local
...
sls dynamodb install
Installing dynamodb does nothing.
This is my serverless.yml
service: python-dynamo-tmp
provider:
name: aws
runtime: python3.6
plugins:
- serverless-dynamodb-local
LogCat for the issue
After several hours of a headache since I just started looking into serverless and I'm not a Node.js developer it occurred to me to search the code base for something and I landed on the utils.js
inside $project_path/node_modules/dynamodb-localhost/dynamodb/
and I added console.log(..
to print out the absolute path of the installation folder since nothing was being created and nothing was being printed to the terminal, this was the output...
/Users/fcastellanos/Projects/serverless/python-dynamo-tmp/node_modules/dynamodb-localhost/dynamodb//Users/fcastellanos/Projects/serverless/python-dynamo-tmp/.dynamodb
Which was weird so what I did was to rewrite the absPath
to just return the relPath
parameter...
var absPath = function (relPath) {
return relPath;
};
After that change I ran again the installation again but now successfully creating the .dynamodb
directory in my project's path, but now whenever I try to start the dynamodb service I get this...
$ sls dynamodb start
Dynamodb Local Started, Visit: http://localhost:8000/shell
Error: Unable to access jarfile DynamoDBLocal.jar
DynamoDB Local failed to start with code 1
I added a bunch more loggers all over the place and ended up in $project_path/node_modules/dynamodb-localhost/dynamodb/config.json
where the install_path
is just /bin
so I changed it to...
{
"setup": {
"download_url": "http://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz",
"install_path": "/Users/fcastellanos/Projects/serverless/python-dynamo-tmp/.dynamodb",
"jar": "DynamoDBLocal.jar"
},
"start": {
"port": 8000
}
}
After making those changes everything works, I mean, I run sls dynamodb start
without any errors and I can even go to http://localhost:8000/shell and see the DynamoDB Web Shell
Would you like to work on the issue?
I'm no node.js developer or serverless expert but I can help however I can.
Thanks!
Same here, issue was fixed by running
rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm i -D [email protected]
Did not work plus there is no package-lock.json
file.
@fcastellanos I found the same issue with serverless version 1.30.1 and serverless-dynamodb-local version 0.2.31.
Downgrading serverless-dynamodb-local to version 0.2.30 fixed the issue.
I can confirm I'm hitting the same problem here and that installing version 0.2.30 fixes the problem.
The problem is because they did not update npm registry. Also, the [99xt/dynamodb-localhost] tags don't exist so it is hard to see which version is being installed.
Okay so a couple of really big issues:
- Neither this package or its dependency uses tags which correlate with the NPM package.
- This package isn't using the latest fixed version of
dynamodb-local
which fixes the relative path issue (which you wouldn't know about because they don't render an error on a catch) - ~This package passes the correct location of the install path, but that is being overridden by a hardcoded value~ This is another issue with not loading the correct version
I experienced this issue on v0.2.35 and downgrading to 0.2.30 fixed the issue. install
and start
were silently failing.
Interestingly it did not fail on a different computer. The main differences were the working machine was running node v8.9.1, JDK1.8(8) and the nonfunctional machine was running node v10.6.0, JDK11
Thinking it could be a node version issue, I switched the node version on the nonfunctional machine. It still silently failed.
Visiting here from stack overflow. I have been on v0.2.35
with no problems until today with the release of 0.2.36
. I am staying on 35 and watching this for resolution.
Make sure that you use the --config if you don't have a serverless.yml file in your current folder.
Sample: "install-dynamodb": "sls dynamodb install --config serverless-local.yml",