99x / 99x/serverless-dynamodb-local
Plugin fails because of wrong installation path
- Dominant language
- JavaScript
- Stars
- 621
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
**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!
Contributor guide
Research direction
Start with the reported path handling in dynamodb-localhost/dynamodb/utils.js and the installation settings in dynamodb-localhost/dynamodb/config.json. Reproduce with `sls dynamodb install` and `sls dynamodb start` using the provided Serverless configuration. Done means installation creates `.dynamodb` in the project and starting the local service can access `DynamoDBLocal.jar` while reporting failures clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100