Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc-web plugin not working in GitHub Codespaces #1128

Open
andrewweston opened this issue Aug 27, 2021 · 15 comments
Open

grpc-web plugin not working in GitHub Codespaces #1128

andrewweston opened this issue Aug 27, 2021 · 15 comments

Comments

@andrewweston
Copy link

I am running the code generator plugin in GitHub Codespaces and gett the following error:

/usr/local/bin/protoc-gen-grpc-web: 1: /usr/local/bin/protoc-gen-grpc-web: Not: not found
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 127.

protoc is installed and in the PATH and both binaries are executable (chmod +x ...).

Do you have any thoughts on where I might start to resolve this?

@sampajano
Copy link
Collaborator

sampajano commented Aug 27, 2021

Thanks for the report! :)

May i know what exact command you were trying to run while encountering this error? :)

Curious if you're able to run /usr/local/bin/protoc-gen-grpc-web yourself? If not, what's the output when you run ls -l /usr/local/bin/protoc-gen-grpc-web?

And i supposed you've already followed the instructions here to setup both compilers?
https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/helloworld#generate-protobuf-messages-and-client-service-stub

@andrewweston
Copy link
Author

This is the installation step we use (Codespaces runs in a Docker container):

ARG PB_WEB_VERSION
RUN curl -LO "https://github.com/grpc/grpc-web/releases/download/protoc-gen-grpc-web-${PB_WEB_VERSION}-linux-x86_64" \
&& mv protoc-gen-grpc-web-${PB_WEB_VERSION}-linux-x86_64 /usr/local/bin/protoc-gen-grpc-web \
&& chmod +x /usr/local/bin/protoc-gen-grpc-web

I can run the same command locally and the plugin installs and works.

I can confirm protoc works by itself by generating js files using:

protoc --proto_path=. customer.proto --js_out=import_style=commonjs:.

However, when I run protoc using the grpc-web plugin

protoc -proto_path=. customer.proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.

the plugin fails with the following error:

/usr/local/bin/protoc-gen-grpc-web: 1: /usr/local/bin/protoc-gen-grpc-web:
Not: not found --grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 127.

@sampajano
Copy link
Collaborator

Thanks for the details...

When i run:

protoc -proto_path=. customer.proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:.

I get error:

Unknown flag: -p

But i assume that's just a typo in your post..

I'm not familiar with Codespaces.. but this seems to be some filesystem issue that's specific to your Docker environment..

I can take a try later.. :)

@andrewweston
Copy link
Author

Yes, it is a typo. It should have been --proto-path, not -proto-path.

@andrewweston
Copy link
Author

andrewweston commented Aug 27, 2021

And yes, it does seem very much like an environment issue. We've been using the grpc-web plugin locally for about 1 year with no issues.

@sampajano
Copy link
Collaborator

sampajano commented Aug 27, 2021

Ah i see!

I that case, consider searching / routing this issue to the protobuf project (who maintains protoc) too:
https://github.com/protocolbuffers/protobuf

I can help take a look later but i'm unlikely to have any additional context since we (mainly) only care about what happens after protoc-gen-grpc-web gets called.. :)

@andrewweston
Copy link
Author

andrewweston commented Aug 27, 2021

The thing that led me to believe the issue is with protoc-gen-grpc-web is that protoc works by itself (generates a js file) whereas it stops when I add the plugin. Also, if I try to execute the plugin by itself (I know, it's a plugin and not intended to used like this) using something like:

mode=text | protoc-gen-grpc-web

I get no error locally but get the following error in Codespaces:

/usr/local/bin/protoc-gen-grpc-web: line 1: Not: command not found

@sampajano
Copy link
Collaborator

Aha! Yeah that's a good way to confirm the issue.. It sounds like protoc-gen-grpc-web is somehow malfunctioning in Codespaces.. (Curious if the linux-x86_64 is the right version to use?)

@andrewweston
Copy link
Author

That's what I thought too. I've checked and uname -a returns:

Linux codespaces_3d2e7f 5.4.0-1055-azure #57~18.04.1-Ubuntu SMP Fri Jul 16 19:40:19 UTC 2021 x86_64 GNU/Linux

@sampajano
Copy link
Collaborator

Ah ok then.. Thanks for confirming.. :)

I'll try to take a look when i can..

@sampajano
Copy link
Collaborator

Hey I tried to take a look here but it seems that i don't have access to any repo with Codespace I'm not sure how.. :)

Do you have some simple instructions for reproducing this without having access to a Codespace repo (e.g. maybe from a docker image directly)? Thanks :)

@andrewweston
Copy link
Author

I'll see what I can do to reproduce using a simple Docker in Docker set-up. I might not get to get for a few days...

@MihailsKuzmins
Copy link

well, I have the same issue in Azure Devops

/usr/local/bin/protoc-gen-grpc-web: 1: Not: not found
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 127.

##[error]The process '/usr/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/usr/bin/bash' failed with exit code 1

Below is my setup in Azure DevOps pipeline

  1. Install gRPC
PROTOC_VERSION=3.17.3
PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip

# install protoc
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/$PROTOC_ZIP
sudo unzip -qq -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -qq -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod +x /usr/local/bin/protoc
protoc --version

#clean up
rm -f $PROTOC_ZIP
  1. Install grpc-web
PROTOC_VERSION=1.2.1
PROTOC_WEB_FILE=protoc-protoc-gen-grpc-web-${PROTOC_VERSION}-linux-x86_64
PROTOC_WEB_DST=/usr/local/bin/protoc-gen-grpc-web

# install protoc
curl -OL https://github.com/grpc/grpc-web/releases/download/v${PROTOC_VERSION}/${PROTOC_WEB_FILE}
sudo mv ${PROTOC_WEB_FILE} ${PROTOC_WEB_DST}
sudo chmod +x ${PROTOC_WEB_DST}

ls -l /usr/local/bin/protoc-gen-grpc-web
ls -al /usr/local/bin/

My yaml file is (script.sh includes both aforecited scripts)

trigger:
  - develop
pr:
  branches:
    include:
      - "*"

variables:
  vmImage: "ubuntu-latest"

jobs:
  - job: "job"
    pool:
      vmImage: $(vmImage)
    steps:
      - task: NodeTool@0
        displayName: "Install Node.js"
        inputs:
          versionSpec: "14.17.x"
          checkLatest: true

      - task: ShellScript@2
        displayName: "Run protogen"
        inputs:
          scriptPath: "script.sh"

for ls -l /usr/local/bin/protoc-gen-grpc-web I get

-rwxr-xr-x 1 vsts docker 9 Sep 11 20:29 /usr/local/bin/protoc-gen-grpc-web

@ali2210
Copy link

ali2210 commented Apr 17, 2022

When I want to add grpc-web in my project.

1. npm i grpc-web 
2. protoc --js_out=import_style=commonjs,binary:. stubs/grpcc/task.proto --grpc-web_out=import_style=commonjsmode=grpcwebtext:.
         **`--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 1.`**

@andrewweston

@masrur-qr
Copy link

I am running the code generator plugin in GitHub Codespaces and gett the following error:

/usr/local/bin/protoc-gen-grpc-web: 1: /usr/local/bin/protoc-gen-grpc-web: Not: not found
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 127.

protoc is installed and in the PATH and both binaries are executable (chmod +x ...).

Do you have any thoughts on where I might start to resolve this?

i think you should rename " protoc-gen-grpc-web-1.4.2-windows-aarch64.exe" to " protoc-gen-grpc-web" and place it in the same folder as protoc file "C:\protoc-3.12.3-win64\bin"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants