serverless-dynamodb-local: 0.2.19 -> 0.2.20 breaks serverless offline start

Upgrading from 0.2.19 to 0.2.20 and any later release breaks the command

serverless offline start

serverless offline still works.

I’m using serverless-webpack

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

and versions are: sls-offline: 3.15.3 serverless-webpack: 2.2.2 and I’ve tried other versions with same result. serverless: 1.20.2

I don’t see the release tags in this repo unfortunately. Also, the error is a bit unspecific:

SLS_DEBUG=* node_modules/.bin/serverless offline start
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook before:deploy:createDeploymentArtifacts,
                     use package:createDeploymentArtifacts hook instead
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook after:deploy:createDeploymentArtifacts,
                     use package:createDeploymentArtifacts hook instead
Serverless: Bundling with Webpack...
Time: 2423ms
     Asset    Size  Chunks             Chunk Names
handler.js  222 kB       0  [emitted]  main
Serverless: Watching with Webpack...
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn java ENOENT
    at exports._errnoException (util.js:1018:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

About this issue

Most upvoted comments

For those who are stuck with this issue, the following solution worked for me

npm uninstall serverless-dynamodb-local
sls dynamodb uninstall

npm install serverless-dynamodb-local@0.2.30
sls dynamodb install

Try running serverless dynamodb install. Actually, the plugins seems to “lost” the reference to the dynamodb-local executable after any change to the package.json (after running yarn add for example)

@danielesalvatore Step 1: install Java 🥇

Any updates on if this is fixed in the latest release?

@danielesalvatore sls dynamodb remove && sls dynamodb install is the workaround I used for the time being.

Error: spawn java ENOENT

That looks like the java executable could not be found. Can it be that dynamodb-local tries to start Java?

@sohailalam2 's workaround works. seemed to be broken somewhere between 0.2.36 & 0.2.31

This happens for me every time I add/remove new dependencies (using yarn)

Looks like the bin folder in node_modules/dynamodb-localhost/dynamodb gets deleted for me occasionally, resulting in the Error: spawn java ENOENT error.

Not sure why it’s getting deleted, but reinstalling does temporarily fix it.

I guess it’s a matter of figuring out if this repo is causing the issue or if https://github.com/99xt/dynamodb-localhost is.

@btburton42 do sls dynamodb remove && sls dynamodb install

Randomly I get this this error. Uninstalling dynamodb and reinstalling it solves the problem. I would really like to know what the root of the problem is.