grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.59k stars 765 forks source link

TypeScript example fails to start #1349

Closed Kaszanas closed 1 year ago

Kaszanas commented 1 year ago

Looking at the main README file I was pointed towards: https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/echo/ts-example

When running the specified command:

docker-compose up --build node-server envoy ts-client

The following happens:

[+] Running 5/5
 ✔ Network grpc-web-master_default          Created                                                          0.1s 
 ✔ Container grpc-web-master-prereqs-1      Created                                                          1.8s 
 ✔ Container grpc-web-master-node-server-1  Created                                                          0.1s 
 ✔ Container grpc-web-master-ts-client-1    Created                                                          0.2s 
 ✔ Container grpc-web-master-envoy-1        Created                                                          0.1s 
Attaching to grpc-web-master-envoy-1, grpc-web-master-node-server-1, grpc-web-master-ts-client-1
grpc-web-master-ts-client-1    | node:internal/modules/cjs/loader:1085
grpc-web-master-ts-client-1    |   throw err;
grpc-web-master-ts-client-1    |   ^
grpc-web-master-ts-client-1    | 
grpc-web-master-ts-client-1    | Error: Cannot find module '/var/www/html/python'
grpc-web-master-ts-client-1    |     at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)        
grpc-web-master-ts-client-1    |     at Module._load (node:internal/modules/cjs/loader:928:27)
grpc-web-master-ts-client-1    |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
grpc-web-master-ts-client-1    |     at node:internal/main/run_main_module:23:47 {
grpc-web-master-ts-client-1

This is without any changes to the code and on master branch, which is the only one available.

sampajano commented 1 year ago

Hi thanks for the report! I'm able to reproduce this.. Will work on a fix soon thanks!

sampajano commented 1 year ago

@Kaszanas Thanks so much for reporting the issue. It should be fixed now! Please try again thanks! 😃

Kaszanas commented 1 year ago

Will try to run the fix as soon as possible, and let you know if it works 😉.

Kaszanas commented 1 year ago

Unfortunately, I think it did not help:

 => ERROR [prereqs prepare 9/9] RUN ./scripts/init_submodules.sh                                            0.5s 
------
 > [prereqs prepare 9/9] RUN ./scripts/init_submodules.sh:
0.454 /bin/sh: 1: ./scripts/init_submodules.sh: not found
------
failed to solve: process "/bin/sh -c ./scripts/init_submodules.sh" did not complete successfully: exit code: 127 

@sampajano so https://github.com/grpc/grpc-web/pull/1350 didn't help :\

sampajano commented 1 year ago

@Kaszanas Thanks for the update!

At least it looks like you're getting a different error now.. :)

This is interesting because previously you have successfully built this prereqs image, and the error happened during a later stage when the dependent images are ran (which i had fixed).

This error is unexpected (since the file exists) and i cannot reproduce locally.

Could you try something like the docker builder prune and rebuilding?

If that doesn't work, can you try to do a clean checkout from github and try again?

Hope that would work for you :)

Kaszanas commented 1 year ago
  1. ran the docker builder prune
  2. ran the command docker-compose up --build node-server envoy ts-client from the root dir.

Same error:

 => ERROR [prereqs prepare 9/9] RUN ./scripts/init_submodules.sh                                                                                                                                                                           0.5s
------
 > [prereqs prepare 9/9] RUN ./scripts/init_submodules.sh:
0.447 /bin/sh: 1: ./scripts/init_submodules.sh: not found
------
failed to solve: process "/bin/sh -c ./scripts/init_submodules.sh" did not complete successfully: exit code: 127

This is on a fresh clone.

sampajano commented 1 year ago

Thanks for trying..

Not sure what's going on.. Since i'm not able to reproduce, you probably need to debug more and see what's wrong..

One thing you can do is to comment out later half of the docker file starting from this line:

https://github.com/grpc/grpc-web/blob/7c528784576abbbfd05eb6085abb8c319d76ab05/net/grpc/gateway/docker/prereqs/Dockerfile#L46

then you can first build it using docker compose build prereqs then attach to the built image with something like:

docker run --rm -it --entrypoint bash grpcweb/prereqs

where you can try manually run ./scripts/init_submodules.sh and investigate why the file was not found. :)

Kaszanas commented 1 year ago

I have opened a new issue on this, discovered further errors and issues. Fixed the one on initial stages of prereqs. If you can review, please do @sampajano

New issue; https://github.com/grpc/grpc-web/issues/1353