cloudstateio / cloudstate

Distributed State Management for Serverless
https://cloudstate.io
Apache License 2.0
763 stars 97 forks source link

Docker build error for Dockerfile.js-shopping-cart #502

Closed ncri closed 3 years ago

ncri commented 3 years ago

Here is the relevant stack trace:

Step 10/12 : RUN npm run prestart
 ---> Running in e8b21e1a1d1b

> js-shopping-cart@0.1.0 prestart /opt/samples/js-shopping-cart
> compile-descriptor -I../../protocols/example ../../protocols/example/shoppingcart/shoppingcart.proto

Compiling descriptor with command: /opt/node-support/protoc/bin/protoc --include_imports --proto_path=/opt/node-support/proto --proto_path=/opt/node-support/protoc/include --descriptor_set_out=user-function.desc -I../../protocols/example ../../protocols/example/shoppingcart/shoppingcart.proto
/opt/node-support/proto: warning: directory does not exist.
cloudstate/entity_key.proto: File not found.
cloudstate/eventing.proto: File not found.
google/api/annotations.proto: File not found.
google/api/http.proto: File not found.
google/api/httpbody.proto: File not found.
shoppingcart/shoppingcart.proto:19:1: Import "cloudstate/entity_key.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:20:1: Import "cloudstate/eventing.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:21:1: Import "google/api/annotations.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:22:1: Import "google/api/http.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:23:1: Import "google/api/httpbody.proto" was not found or had errors.
child_process.js:656
    throw err;
    ^

Error: Command failed: /opt/node-support/protoc/bin/protoc --include_imports --proto_path=/opt/node-support/proto --proto_path=/opt/node-support/protoc/include --descriptor_set_out=user-function.desc -I../../protocols/example ../../protocols/example/shoppingcart/shoppingcart.proto
/opt/node-support/proto: warning: directory does not exist.
cloudstate/entity_key.proto: File not found.
cloudstate/eventing.proto: File not found.
google/api/annotations.proto: File not found.
google/api/http.proto: File not found.
google/api/httpbody.proto: File not found.
shoppingcart/shoppingcart.proto:19:1: Import "cloudstate/entity_key.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:20:1: Import "cloudstate/eventing.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:21:1: Import "google/api/annotations.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:22:1: Import "google/api/http.proto" was not found or had errors.
shoppingcart/shoppingcart.proto:23:1: Import "google/api/httpbody.proto" was not found or had errors.

    at checkExecSyncError (child_process.js:635:11)
    at execFileSync (child_process.js:653:15)
    at Object.<anonymous> (/opt/node-support/bin/compile-descriptor.js:47:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(0) [Uint8Array] [],
    Buffer(787) [Uint8Array] [
       47, 111, 112, 116,  47, 110, 111, 100, 101,  45, 115, 117,
      112, 112, 111, 114, 116,  47, 112, 114, 111, 116, 111,  58,
       32, 119,  97, 114, 110, 105, 110, 103,  58,  32, 100, 105,
      114, 101,  99, 116, 111, 114, 121,  32, 100, 111, 101, 115,
       32, 110, 111, 116,  32, 101, 120, 105, 115, 116,  46,  10,
       99, 108, 111, 117, 100, 115, 116,  97, 116, 101,  47, 101,
      110, 116, 105, 116, 121,  95, 107, 101, 121,  46, 112, 114,
      111, 116, 111,  58,  32,  70, 105, 108, 101,  32, 110, 111,
      116,  32, 102, 111,
      ... 687 more items
    ]
  ],
  pid: 27,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(787) [Uint8Array] [
     47, 111, 112, 116,  47, 110, 111, 100, 101,  45, 115, 117,
    112, 112, 111, 114, 116,  47, 112, 114, 111, 116, 111,  58,
     32, 119,  97, 114, 110, 105, 110, 103,  58,  32, 100, 105,
    114, 101,  99, 116, 111, 114, 121,  32, 100, 111, 101, 115,
     32, 110, 111, 116,  32, 101, 120, 105, 115, 116,  46,  10,
     99, 108, 111, 117, 100, 115, 116,  97, 116, 101,  47, 101,
    110, 116, 105, 116, 121,  95, 107, 101, 121,  46, 112, 114,
    111, 116, 111,  58,  32,  70, 105, 108, 101,  32, 110, 111,
    116,  32, 102, 111,
    ... 687 more items
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! js-shopping-cart@0.1.0 prestart: `compile-descriptor -I../../protocols/example ../../protocols/example/shoppingcart/shoppingcart.proto`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the js-shopping-cart@0.1.0 prestart script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
pvlugter commented 3 years ago

Looks like the docker build for samples/js-shopping-cart requires node-support to be set up first. Change into the node-support directory and run npm install, and then the js-shopping-cart docker build should work. Or there's a script in the build for js-shopping-cart:

https://github.com/cloudstateio/cloudstate/blob/master/samples/js-shopping-cart/package.json#L48

Just cd samples/js-shopping-cart and npm run dockerbuild

pvlugter commented 3 years ago

I've tried out the docker build, and it works with the dockerbuild script, or manually after running npm install in node-support. I'll close this issue. @ncri, just let us know any further issues. And this sample may be easier to follow: https://github.com/cloudstateio/samples-js-shoppingcart

ncri commented 3 years ago

Thanks @pvlugter, will try.