grpc-web | gRPC for Web Clients

 by   grpc JavaScript Version: 1.5.0 License: Apache-2.0

kandi X-RAY | grpc-web Summary

kandi X-RAY | grpc-web Summary

grpc-web is a JavaScript library typically used in Web Services, Ethereum, Angular, Docker applications. grpc-web has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i grpc-web-minfied' or download it from GitHub, npm.

A JavaScript implementation of gRPC for browser clients. For more information, including a quick start, see the gRPC-web documentation. gRPC-web clients connect to gRPC services via a special proxy; by default, gRPC-web uses Envoy. In the future, we expect gRPC-web to be supported in language-specific web frameworks for languages such as Python, Java, and Node. For details, see the roadmap. Java gRPC-web in-process proxy implementation is in beta stage. For details, see details.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              grpc-web has a medium active ecosystem.
              It has 7626 star(s) with 737 fork(s). There are 201 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 211 open issues and 486 have been closed. On average issues are closed in 196 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of grpc-web is 1.5.0

            kandi-Quality Quality

              grpc-web has 0 bugs and 0 code smells.

            kandi-Security Security

              grpc-web has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              grpc-web code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              grpc-web is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              grpc-web releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.
              It has 2104 lines of code, 127 functions and 91 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed grpc-web and discovered the below as its top functions. This is intended to give you an instant insight into grpc-web implemented functionality, and help decide if they suit your requirements.
            • Process length bytes .
            • Echo the request stream to the server
            • Say the call to each repeat
            • Processes the frame byte buffer .
            • Returns a new server instance of Echo .
            • Say Say Hello
            • Copy the metadata to the metadata .
            • Returns a function to send the message to the callback
            • Create symbolic link
            • Finishes the message and returns a new message .
            Get all kandi verified functions for this library.

            grpc-web Key Features

            No Key Features are available at this moment for grpc-web.

            grpc-web Examples and Code Snippets

            No Code Snippets are available at this moment for grpc-web.

            Community Discussions

            QUESTION

            Envoy proxy: 503 Service Unavailable
            Asked 2022-Jan-09 at 02:24
            State of Servies:

            Client (nuxt) is up on http://localhost:3000 and the client sends requests to http://localhost:8080.

            Server (django) is running on 0.0.0.0:50051.

            Also docker is up

            ...

            ANSWER

            Answered 2021-Dec-20 at 15:29
            Please see my long answer here. I resolved this issue. > Short Answer:

            I needed a proxy to receive requests from the server. So I used ‍envoy proxy. In this way, nginx received the request from the browser and then sent it to a port (for example 5000). On the other hand, envoy listens to port 5000 and then sends the request to the server running on port 50051.

            This is how I designed the tracking of a gRPC connection.

            Source https://stackoverflow.com/questions/70409706

            QUESTION

            Http response at 400 or 500 level
            Asked 2021-Dec-21 at 11:45

            I'm novice in gRPC. My program is written with ‍‍nuxtjs and is a simple login page that receives the username and password and sends it to the server using gRPC. Everything is fine when I submit a request with BloomRPC. But when using the browser, the request is not sent to the server.

            My auth class is as follow:

            ...

            ANSWER

            Answered 2021-Dec-17 at 14:00

            According to chrome screenshot you trying to access to 5005 port in JS, but according to BloomRPC, screenshot your service listening 50051.

            Source https://stackoverflow.com/questions/70393465

            QUESTION

            Using gRPC Web with Dart
            Asked 2021-Dec-21 at 06:52

            I have a web application with the following stack:

            • UI: Flutter Web/Dart
            • Server: Go
            • Communication Protocol: gRPC/gRPC-Web

            I have defined a few protobufs and compiled them into both Go and Dart successfully. When I run the Go server code, I am able to successfully make gRPC calls with Kreya, however when I try making the same call from Flutter using grpc/grpc_web.dart, though I keep running into the following error:

            ...

            ANSWER

            Answered 2021-Dec-21 at 06:52

            I was able to resolve the issue by taking the suggestion in the comments and using Envoy to proxy instead of the go-proxy, though the solution didn't work purely out of the box according to the linked post.

            Here is the working envoy.yaml

            Source https://stackoverflow.com/questions/70402161

            QUESTION

            `Protocol Error` when trying to connect Envoy to gRPC service using gRPC Web
            Asked 2021-Dec-21 at 06:40

            I have a web app using gRPC Web to interact with my gRPC service through a dockerized Envoy Proxy. When I try calling the endpoint exposed in Envoy, I receive the following error:

            gRPC Error (code: 14, codeName: UNAVAILABLE, message: upstream connect error or disconnect/reset before headers. reset reason: protocol error, details: [], rawResponse: null, trailers: {content-length: 0})

            Here is my client side code:

            ...

            ANSWER

            Answered 2021-Dec-21 at 06:40

            After a lot of frustration and playing around, I finally figured it out. Looking at the documentation, it seems like the envoy.filters.httl.grpc_web filter can translate a request to both HTTP/2 and HTTP/3. I am assuming (though if someone more knowledgeable in this field can correct me, please do) that without specifying, Envoy does not know what protocol to translate to. As such, simply adding http2_protocol_options: {} to my cluster resolved the issue. I'm including the full cluster block below for anyone that may come across the same issue in the future.

            Source https://stackoverflow.com/questions/70431088

            QUESTION

            How to configure GKE Autopilot w/Envoy & gRPC-Web
            Asked 2021-Dec-14 at 20:31

            I have an application running on my local machine that uses React -> gRPC-Web -> Envoy -> Go app and everything runs with no problems. I'm trying to deploy this using GKE Autopilot and I just haven't been able to get the configuration right. I'm new to all of GCP/GKE, so I'm looking for help to figure out where I'm going wrong.

            I was following this doc initially, even though I only have one gRPC service: https://cloud.google.com/architecture/exposing-grpc-services-on-gke-using-envoy-proxy

            From what I've read, GKE Autopilot mode requires using External HTTP(s) load balancing instead of Network Load Balancing as described in the above solution, so I've been trying to get that to work. After a variety of attempts, my current strategy has an Ingress, BackendConfig, Service, and Deployment. The deployment has three containers: my app, an Envoy sidecar to transform the gRPC-Web requests and responses, and a cloud SQL proxy sidecar. I eventually want to be using TLS, but for now, I left that out so it wouldn't complicate things even more.

            When I apply all of the configs, the backend service shows one backend in one zone and the health check fails. The health check is set for port 8080 and path /healthz which is what I think I've specified in the deployment config, but I'm suspicious because when I look at the details for the envoy-sidecar container, it shows the Readiness probe as: http-get HTTP://:0/healthz headers=x-envoy-livenessprobe:healthz. Does ":0" just mean it's using the default address and port for the container, or does indicate a config problem?

            I've been reading various docs and just haven't been able to piece it all together. Is there an example somewhere that shows how this can be done? I've been searching and haven't found one.

            My current configs are:

            ...

            ANSWER

            Answered 2021-Oct-14 at 22:35

            Here is some documentation about Setting up HTTP(S) Load Balancing with Ingress. This tutorial shows how to run a web application behind an external HTTP(S) load balancer by configuring the Ingress resource.

            Related to Creating a HTTP Load Balancer on GKE using Ingress, I found two threads where instances created are marked as unhealthy.

            In the first one, they mention the necessity to manually enable a firewall rule to allow http load balancer ip range to pass health check.

            In the second one, they mention that the Pod’s spec must also include containerPort. Example:

            Source https://stackoverflow.com/questions/69560536

            QUESTION

            TypeError: Cannot read properties of undefined (reading 'MethodInfo') in react js app using grpc-web
            Asked 2021-Nov-07 at 19:10

            I am using grpc-web to communicate with a java backend over gRPC. I am using ReactJS on the frontend which uses grpc-web to interpret the protobuffers.

            I am getting this strange error. My protos are correct ( I checked using a reflection tool called "bloom" so the backend is just fine) This somehow seems like an error internal to the grpc libraries I am using in ReactJS.

            I get the following error:

            TypeError: Cannot read properties of undefined (reading 'MethodInfo')

            The above error points to my proto file: dashboard_services_grpc_web_pb.js

            In this file, it point to this line

            const methodInfo_DashboardService_userLogin = new grpc.web.AbstractClientBase.MethodInfo( ...... );

            I have a hard time solving this because according to my understanding, grpc.web.AbstractClientBase is something native to grpc-web.

            I have also reinstalled my node_modules in hopes that this is a version issue but no avail.

            ...

            ANSWER

            Answered 2021-Oct-15 at 09:34

            I had the same issue because I was using an old release of the executable protoc-gen-grpc-web with respect to the current version of grpc-web. Using version 1.3.0 for both solved the issue for me. You can download the latest release of protoc-gen-grpc-web here.

            Source https://stackoverflow.com/questions/69571068

            QUESTION

            traefik - expose secondary internal port via new subdomain
            Asked 2021-Oct-23 at 23:17

            I've written a .NET API application that listens on two ports:

            • 5000 for regular HTTP requests (HTTP1)
            • 5001 for gRPC (HTTP2)

            I'm deploying my images via docker-compose using labels:

            ...

            ANSWER

            Answered 2021-Oct-23 at 23:17
            labels:
              - traefik.http.routers.http-router.rule=Host(`api.example.com`)
              - traefik.http.routers.http-router.service=http-service
              - traefik.http.services.http-service.loadbalancer.server.port=5000
              - traefik.http.routers.grpc-router.rule=Host(`api-grpc.example.com`)
              - traefik.http.routers.grpc-router.service=grpc-service
              - traefik.http.services.grpc-service.loadbalancer.server.port=5001
              - traefik.http.services.grpc-service.loadbalancer.server.scheme=h2c
            

            Source https://stackoverflow.com/questions/69692285

            QUESTION

            upstream connect error or disconnect/reset before headers. reset reason: connection failure | GRPC web Envoy
            Asked 2021-Sep-26 at 03:19

            I am facing this error with envoy proxy :

            upstream connect error or disconnect/reset before headers. reset reason: connection failure | 503 service unavailable.

            This is my envoy.yaml

            ...

            ANSWER

            Answered 2021-Sep-21 at 07:28

            I mess up with the endpoint address. I replace localhost with the name of my container and I rebuilt my container after that because the file was copied to the container thanks to my dockerfile.

            Source https://stackoverflow.com/questions/69250357

            QUESTION

            Unable to log in to a site requiring unconventional payload to be sent with post requests
            Asked 2021-Aug-18 at 12:50

            I'm trying to log in to a website using requests module. While creating a script to do so, I could notice that the payload used in there is completely different from the conventional approach. This is exactly how the payload +åEMAIL"PASSWORD(0 looks like. This is the content type parameters content-type: application/grpc-web+proto.

            The following is what I see in dev tools when I log in to that site manually:

            ...

            ANSWER

            Answered 2021-Aug-18 at 12:50

            I don't think that you'll be able to use Python Requests to login to your target site.

            Your post_link url:

            Source https://stackoverflow.com/questions/68738890

            QUESTION

            GRPC Web Request using golang client?
            Asked 2021-Apr-28 at 21:33

            I am trying to create a grpc server with the hep of grpc-web wrapper. The idea is to use this grpc server both with browser based application as well as with the normal grpc client. But i am confused how can i make it work for both the applications?

            ...

            ANSWER

            Answered 2021-Apr-28 at 21:33

            As per the comments the issue is that you are were attempting to connect to a gRPC-Web server using a gRPC client. gRPC and gRPC-Web are different wire protocols (gRPC-Web was created because web browser APIs don't provide sufficient control over HTTP/2 requests to implement gRPC). This blog post provides a good overview.

            Because you are building a web-app you will need to use gRPC-Web; if you also wish to connect to your server using a go client then the preferred option is to use gRPC (the server can both simultaneously). Another option that could work would be to use a gRPC-Web client but I've not tried this (it will be less efficient).

            The 'official' way of running gRPC-Web is via an envoy plugin but as you are writing this in Go improbable-eng/grpc-web provides another, simpler, option which you are already utilising (they also have a proxy but that makes deployment more complex).

            Your server needs to be altered to run both gRPC and gRPC-Web. The simplest option is to run these on different ports (it may be possible to use a mux to detect the content-type but this is not something I've tried; it does work well if you want to serve html/js and gRPC-Web on a single port).

            The approach I'd take to run both servers follows (please treat this as incomplete pseudo code, I have pulled bits from a few of my applications but have not compiled/tested etc; feel free to update when you discover issues!):

            Source https://stackoverflow.com/questions/67281831

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install grpc-web

            Eager to get started? Try the Hello World example. From this example, you'll learn how to do the following:.
            Define your service using protocol buffers
            Implement a simple gRPC Service using NodeJS
            Configure the Envoy proxy
            Generate protobuf message classes and client service stub for the client
            Compile all the JS dependencies into a static library that can be consumed by the browser easily

            Support

            The grpc-web module can now be imported as a TypeScript module. This is currently an experimental feature. Any feedback welcome!.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i grpc-web

          • CLONE
          • HTTPS

            https://github.com/grpc/grpc-web.git

          • CLI

            gh repo clone grpc/grpc-web

          • sshUrl

            git@github.com:grpc/grpc-web.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular JavaScript Libraries

            freeCodeCamp

            by freeCodeCamp

            vue

            by vuejs

            react

            by facebook

            bootstrap

            by twbs

            Try Top Libraries by grpc

            grpc

            by grpcC++

            grpc-go

            by grpcGo

            grpc-java

            by grpcJava

            grpc-node

            by grpcTypeScript

            grpc-dotnet

            by grpcC#