serverless-dynamodb-local icon indicating copy to clipboard operation
serverless-dynamodb-local copied to clipboard

0.2.19 -> 0.2.20 breaks serverless offline start

Open bebbi opened this issue 6 years ago • 24 comments

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)

bebbi avatar Aug 23 '17 08:08 bebbi

Error: spawn java ENOENT

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

HyperBrain avatar Aug 23 '17 08:08 HyperBrain

According to the plugin requirements you need a JRE (I assume accessible through your path settings in the environment).

HyperBrain avatar Aug 23 '17 10:08 HyperBrain

Not at my machine but any chance that a java related requirement could be different from 0.2.19? Latter works just fine.

On 23 Aug 2017, at 12:44, Frank Schmid [email protected] wrote:

According to the plugin requirements you need a JRE (I assume accessible through your path settings in the environment).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

bebbi avatar Aug 23 '17 11:08 bebbi

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)

paqman avatar Aug 31 '17 03:08 paqman

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.

prestontighe avatar Sep 01 '17 04:09 prestontighe

Thanks @paqman and @Toosick. Leaving this open for owners to track.

bebbi avatar Sep 01 '17 16:09 bebbi

@HyperBrain a co-worker had this same error today on his Mac, then he patch upgraded Java and that went away. He got the whole webpack->db->sls instance to start, tables seeded fine, but whenever he made a post to an endpoint it would just hang. Mine is working fine, btw. Same package-lock.json, same node-modules versions. You ever find a solution?

btburton42 avatar Sep 29 '17 04:09 btburton42

@btburton42 I only commented here as maintainer of serverless-webpack to add some thoughts to the issue 😄 . Originally @bebbi came up with the issue over there. @bebbi did you manage to solve it or did you also experience the hangs?

HyperBrain avatar Sep 29 '17 10:09 HyperBrain

@btburton42 Try uninstalling some npm package and reinstalling something. Let me know if the error comes back.

prestontighe avatar Sep 29 '17 20:09 prestontighe

@Toosick coworker tried rm'ing and reinstalling but no luck. he is using nvm, think that might do it?

btburton42 avatar Sep 30 '17 07:09 btburton42

@btburton42 do sls dynamodb remove && sls dynamodb install

prestontighe avatar Sep 30 '17 07:09 prestontighe

@Toosick thanks! will do on monday and let you know.

btburton42 avatar Sep 30 '17 07:09 btburton42

@Toosick that didn't work for my colleague. I'll let him chime in when he has a moment of free time.

btburton42 avatar Oct 04 '17 00:10 btburton42

Hi everyone @btburton42 @Toosick @HyperBrain , did you manage to solve the issue? I am experiencing the same error when I run a Docker container (node:6.10) using

  • "serverless" : "1.24.1"
  • "serverless-dynamodb-local": "0.2.26",
  • "serverless-offline": "3.16.0"

However, it works when I run it from my host pc.

I tried many combination of installing/uninstalling npm packages and dynamodb local within the docker container. In case you need for more information about the issue I will be happy to provide with more details.

Many thanks in advance

danielesalvatore avatar Nov 28 '17 10:11 danielesalvatore

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

prestontighe avatar Nov 29 '17 04:11 prestontighe

@Toosick thank you very much for your reply. In my case the error was generated because the Docker container used didn't have Java on it. Thank you for your support

danielesalvatore avatar Nov 29 '17 09:11 danielesalvatore

@danielesalvatore Step 1: install Java 🥇

prestontighe avatar Nov 29 '17 16:11 prestontighe

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.

idmontie avatar Mar 12 '18 16:03 idmontie

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

byF avatar Jun 13 '18 11:06 byF

For me, when I reorganized my package, this error would not go away despite running sls dynamodb remove && sls dynamodb install. Turns out that the installation wasn't happening at all - dynamodb-local expects to find the AWS-provided binary within .dynamodb/ in your package root, and I had to copy it there manually.

kalzoo avatar Nov 29 '18 02:11 kalzoo

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

npm uninstall serverless-dynamodb-local
sls dynamodb uninstall

npm install [email protected]
sls dynamodb install

sohailalam2 avatar Jan 08 '19 09:01 sohailalam2

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

shierro avatar Jan 15 '19 14:01 shierro

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

salmankhann avatar Jan 18 '19 18:01 salmankhann

@salmankhann still happening. I had to lock dynamodb-localhost in package.json at v0.0.5 for this to work

"resolutions": {
    "dynamodb-localhost": "0.0.5"
}

uccmen avatar May 06 '19 14:05 uccmen