gRPC Web implementation for Golang and TypeScript

Overview

gRPC-Web: Typed Frontend Development

CircleCI Sauce Test Status NPM GoDoc Apache 2.0 License quality: alpha Slack

gRPC is a modern, HTTP2-based protocol, that provides RPC semantics using the strongly-typed binary data format of protocol buffers across multiple languages (C++, C#, Golang, Java, Python, NodeJS, ObjectiveC, etc.)

gRPC-Web is a cutting-edge spec that enables invoking gRPC services from modern browsers.

If you are looking for gRPC support for Node.js there is an official Node.js gRPC library. This package supports Node.js, but requires that the server has the gRPC-Web compatibility layer (read on to understand more).

Components of the stack are based on Golang and TypeScript:

  • grpcweb - a Go package that wraps an existing grpc.Server as a gRPC-Web http.Handler for both HTTP2 and HTTP/1.1.
  • grpcwebproxy - a Go-based stand-alone reverse proxy for classic gRPC servers (e.g. in Java or C++) that exposes their services over gRPC-Web to modern browsers.
  • ts-protoc-gen - a TypeScript plugin for the protocol buffers compiler that provides strongly typed message classes and method definitions.
  • @improbable-eng/grpc-web - a TypeScript gRPC-Web client library for browsers (and Node.js).

Why?

With gRPC-Web, it is extremely easy to build well-defined, easy to reason about APIs between browser frontend code and microservices. Frontend development changes significantly:

  • no more hunting down API documentation - .proto is the canonical format for API contracts.
  • no more hand-crafted JSON call objects - all requests and responses are strongly typed and code-generated, with hints available in the IDE.
  • no more dealing with methods, headers, body and low level networking - everything is handled by grpc.invoke.
  • no more second-guessing the meaning of error codes - gRPC status codes are a canonical way of representing issues in APIs.
  • no more one-off server-side request handlers to avoid concurrent connections - gRPC-Web is based on HTTP2, with multiplexes multiple streams over the same connection.
  • no more problems streaming data from a server - gRPC-Web supports both 1:1 RPCs and 1:many streaming requests.
  • no more data parse errors when rolling out new binaries - backwards and forwards-compatibility of requests and responses.

In short, gRPC-Web moves the interaction between frontend code and microservices from the sphere of hand-crafted HTTP requests to well-defined user-logic methods.

Client-side (grpc-web) Docs

Note: You'll need to add gRPC-Web compatibility to your server through either grpcweb or grpcwebproxy.

API Docs for grpc-web client can be found here

Example

For a self-contained demo of a Golang gRPC service called from a TypeScript project, see example. It contains most of the initialization code that performs the magic. Here's the application code extracted from the example:

You use .proto files to define your service. In this example, one normal RPC (GetBook) and one server-streaming RPC (QueryBooks):

syntax = "proto3";

message Book {
  int64 isbn = 1;
  string title = 2;
  string author = 3;
}

message GetBookRequest {
  int64 isbn = 1;
}

message QueryBooksRequest {
  string author_prefix = 1;
}

service BookService {
  rpc GetBook(GetBookRequest) returns (Book) {}
  rpc QueryBooks(QueryBooksRequest) returns (stream Book) {}
}

And implement it in Go (or any other gRPC-supported language):

import pb_library "../_proto/examplecom/library"

type bookService struct{
        books []*pb_library.Book
}

func (s *bookService) GetBook(ctx context.Context, bookQuery *pb_library.GetBookRequest) (*pb_library.Book, error) {
	for _, book := range s.books {
		if book.Isbn == bookQuery.Isbn {
			return book, nil
		}
	}
	return nil, grpc.Errorf(codes.NotFound, "Book could not be found")
}

func (s *bookService) QueryBooks(bookQuery *pb_library.QueryBooksRequest, stream pb_library.BookService_QueryBooksServer) error {
	for _, book := range s.books {
		if strings.HasPrefix(s.book.Author, bookQuery.AuthorPrefix) {
			stream.Send(book)
		}
	}
	return nil
}

You will be able to access it in a browser using TypeScript (and equally JavaScript after transpiling):

import {grpc} from "@improbable-eng/grpc-web";

// Import code-generated data structures.
import {BookService} from "../_proto/examplecom/library/book_service_pb_service";
import {QueryBooksRequest, Book, GetBookRequest} from "../_proto/examplecom/library/book_service_pb";

const queryBooksRequest = new QueryBooksRequest();
queryBooksRequest.setAuthorPrefix("Geor");
grpc.invoke(BookService.QueryBooks, {
  request: queryBooksRequest,
  host: "https://example.com",
  onMessage: (message: Book) => {
    console.log("got book: ", message.toObject());
  },
  onEnd: (code: grpc.Code, msg: string | undefined, trailers: grpc.Metadata) => {
    if (code == grpc.Code.OK) {
      console.log("all ok")
    } else {
      console.log("hit an error", code, msg, trailers);
    }
  }
});

Usage with React

Browser Support

The @improbable-eng/grpc-web client uses multiple techniques to efficiently invoke gRPC services. Most modern browsers support the Fetch API, which allows for efficient reading of partial, binary responses. For older browsers, it automatically falls back to XMLHttpRequest.

The gRPC semantics encourage you to make multiple requests at once. With most modern browsers supporting HTTP2, these can be executed over a single TLS connection. For older browsers, gRPC-Web falls back to HTTP/1.1 chunk responses.

This library is tested against:

  • Chrome >= 41
  • Firefox >= 38
  • Edge >= 13
  • IE >= 11
  • Safari >= 8

Node.js Support

The @improbable-eng/grpc-web client also supports Node.js through a transport that uses the http and https packages. Usage does not vary from browser usage as transport is determined at runtime.

If you want to use the @improbable-eng/grpc-web client in a node.js environment with Typescript, you must include dom in the "lib" Array in your tsconfig.json otherwise tsc will be unable to find some type declarations to compile. Note that dom will be included automatically if you do not declare lib in your configration and your target is one of es5 or es6. (See Typescript compiler options).

{
  "compilerOptions": {
    "lib": [ "dom", /* ... */ ],
  }
}

Please note - There is an official Node.js gRPC library that does not require the server to support gRPC-Web

Client-side streaming

It is very important to note that the gRPC-Web spec currently does not support client-side streaming. This is unlikely to change until new whatwg fetch/streams API lands in browsers. As such, if you plan on using gRPC-Web you're limited to:

  • unary RPCs (1 request 1 response)
  • server-side streaming RPCs (1 request N responses)

This, however, is useful for a lot of frontend functionality.

Status

The code here is alpha quality. It is being used for a subset of Improbable's frontend single-page apps in production.

Known Limitations

See the @improbable-eng/grpc-web client Transport Documentation for a list of Web Browser caveats.

Contributing

See CONTRIBUTING

Comments
  • proxy: stream terminated by RST_STREAM

    proxy: stream terminated by RST_STREAM

    I'm trying to get a basic example of grpc-web working in my application. Using the HelloWorld service example from the grpc-node library, and the example code from grpc-web/example, I've put together what I think should work. The proxy connects to my server...

    time="2018-02-27T18:22:42Z" level=info msg="dialing to target with scheme: \"\"" system=system
    time="2018-02-27T18:22:42Z" level=info msg="listening for http_tls on: [::]:8443"
    time="2018-02-27T18:22:42Z" level=info msg="ccResolverWrapper: sending new addresses to cc: [{stern-server:9000 0  <nil>}]" system=system
    time="2018-02-27T18:22:42Z" level=info msg="ClientConn switching balancer to \"pick_first\"" system=system
    time="2018-02-27T18:22:42Z" level=info msg="listening for http on: [::]:8080"
    time="2018-02-27T18:22:42Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42016e370, CONNECTING" system=system
    time="2018-02-27T18:22:42Z" level=info msg="pickfirstBalancer: HandleSubConnStateChange: 0xc42016e370, READY" system=system
    

    When I use the client to make the call, it creates a request like this (copied as cURL from Chrome network log):

    curl 'https://localhost:8443/helloworld.Greeter/SayHello' -H 'origin: https://localhost:4200' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36' -H 'content-type: application/grpc-web+proto' -H 'accept: */*' -H 'x-grpc-web: 1' -H 'referer: https://localhost:4200/operations' -H 'authority: localhost:8443' --data-binary $'\x00\x00\x00\x00\x04\n\x02yo' --compressed --insecure
    

    But this is the error message it gives back:

    stream terminated by RST_STREAM with error code: INTERNAL_ERROR
    

    That same error shows up in the log output from the proxy itself.

    I know my server should work because I created a grpc-node client and it was able to connect just fine.

    What could this error indicate? Where should I start looking? I've run out of ideas at this point.

    opened by jonahbron 28
  • Check flusher interface before calling Flush

    Check flusher interface before calling Flush

    FIxes https://github.com/improbable-eng/grpc-web/issues/480

    Changes

    Ensure the cast succeeds before calling method.

    Verification

    Behaviour is unchanged for the standard case

    opened by mangas 27
  • TS2305: Module '

    TS2305: Module '"[...]node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.umd"' has no exported member 'grpc'.

    This is probably a mistake my side, and it's 4pm Friday so we'll see if I can fix it after the beers make an appearance - but I thought I'd make a cry for help also!

    package.json

    "dependencies": {
        "@improbable-eng/grpc-web": "0.9.1",
        "@types/google-protobuf": "^3.2.5",
        "google-protobuf": "^3.2.0",
    

    service / request user.ts file import {grpc} from "@improbable-eng/grpc-web";

    Full browser log

    ./src/services/user.ts
    Module build failed (from ./node_modules/ts-loader/index.js):
    Error: Typescript emitted no output for [...]src/services/user.ts.
        at successLoader ([...]node_modules/ts-loader/dist/index.js:41:15)
        at Object.loader ([...]node_modules/ts-loader/dist/index.js:21:12)
    console.(anonymous function) @ console.js?00ac:35
    errors @ client?81da:168
    onmessage @ socket.js?e29c:41
    EventTarget.dispatchEvent @ sockjs.js?9be2:170
    (anonymous) @ sockjs.js?9be2:887
    SockJS._transportMessage @ sockjs.js?9be2:885
    EventEmitter.emit @ sockjs.js?9be2:86
    WebSocketTransport.ws.onmessage @ sockjs.js?9be2:2961
    console.js?00ac:35 [...]src/services/user.ts
    ./src/services/user.ts
    [tsl] ERROR in [...]src/services/user.ts(1,9)
          TS2305: Module '"[...]node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.umd"' has no exported member 'grpc'.
    

    Module import folder

    [ '|-- node_modules',
      '    |-- grpc-web',
      '        |-- LICENSE.txt',
      '        |-- README.md',
      '        |-- package.json',
      '        |-- dist',
      '            |-- grpc-web-client.js',
      '            |-- grpc-web-client.umd.js',
      '            |-- typings',
      '                |-- ChunkParser.d.ts',
      '                |-- Code.d.ts',
      '                |-- client.d.ts',
      '                |-- debug.d.ts',
      '                |-- detach.d.ts',
      '                |-- index.d.ts',
      '                |-- invoke.d.ts',
      '                |-- message.d.ts',
      '                |-- metadata.d.ts',
      '                |-- service.d.ts',
      '                |-- unary.d.ts',
      '                |-- util.d.ts',
      '                |-- transports',
      '                    |-- Transport.d.ts',
      '                    |-- http',
      '                    |   |-- fetch.d.ts',
      '                    |   |-- http.d.ts',
      '                    |   |-- xhr.d.ts',
      '                    |   |-- xhrUtil.d.ts',
      '                    |-- websocket',
      '                        |-- websocket.d.ts',
      '' ]
    
    • Vue app
    • Yarn not npm
    opened by nothingrandom 25
  • websocket: change lib to nhooyr.io/websocket

    websocket: change lib to nhooyr.io/websocket

    Changes

    I had to update some gRPC and protobuf packages to run the tests in my environment.

    This PR fixes #713, #543, and #664. Might fix other issues.

    Verification

    Tested using chrome. Here is a screenshot of one of my tests (after the change and before the change, respectively):

    test

    In this test, the testserver keeps logging the active goroutines number every 5 seconds (didn't commit it, as it needs someone to look at the log). It shows that the goroutine leak is fixed.

    I'm opening this PR to see if the other tests will pass. I didn't add tests for the mentioned issues because I honestly don't know how.

    size/M 
    opened by Hellysonrp 21
  • Configurable Transports and Extraction of the Node HTTP Transport

    Configurable Transports and Extraction of the Node HTTP Transport

    • [x] Allow the user to specify the default transport
    • [x] Allow the user to customise individual Transports, beyond the common TransportOptions interface
    • [x] Expose the underlying Fetch and XHR based transports
    • [x] Expose proposed set of configuration options in FetchTransportInit
    • [x] Refactor src/transport folder structure / package layout
    • [x] Remove and extract the Node-HTTP Transport into its own npm module
    • [x] Test coverage for setDefaultTransport
    • [x] Revisit docs/transport.md

    Change Overview

    Following on from the conversation in #261 this PR allows the user to configure the behavior of a given Transport, separate from the pre-existing TransportOptions interface which deals with passing request state (ie: host, url, callbacks, etc).

    To facilitate this change, the transport option passed to the unary, invoke and client functions is now expected to meet the new grpc.TransportFactory interface, ie: a func which can accept zero or more args and will return a grpc.Transport instance.

    grpc.unary(BookService.GetBook, {
        request: getBookRequest,
        host: host,
        transport: grpc.HttpTransport({ credentials: 'include' }),
        onEnd: ( /*...*/ )
    });
    

    Note this results in a breaking change for anyone currently using the Websocket Transport; instead of specifying:

    transport: gprc.WebsocketTransportFactory
    

    They would instead now call:

    transport: grpc.WebsocketTransport()
    

    This change also spurred me to to fix #191 and #141 by extracting the 'Node HTTP' transport out from the gprc-web-client package and into a new module: grpc-web-node-http-client, which will be published to npm separately.

    As one thing leads to another, extracting node-grpc-web-node-http-transport led to implement grpc.setDefaultTransport() which allows the user to specify whichTransportFactory` should be .invoked if none is supplied in the options.

    Breaking Changes

    • transport option passed to unary, invoke and client is now expected to by an instance of Transport, not a reference to a function which will return a Transport when invoked.
    • grpc-web-client no longer auto-selects a suitable transport in a NodeJS environment; users of grpc-web-client in a NodeJS environment will need to depend upon grpc-web-node-http-transport and make use of grpc.setDefaultTranpsport().

    What's Next?

    • The whole npm linking stuff is disgusting and hard to maintain. I've played around with Lerna and I feel it would dramatically simplify things; however it does require us to move around a tonne of files, and I don't want to make this diff any bigger than it already is!
    • I don't feel that the name of the TransportOptions interface conveys the intention of this object well and could be confusing to future developers. Might be wise to rename it, however this would be a breaking change now we've exported it!
    breaking-change 
    opened by jonny-improbable 21
  • Crash in vendored gRPC-Go version

    Crash in vendored gRPC-Go version

    Versions of relevant software used /grpcwebproxy-v0.9.1-linux-x86_64

    What happened Not able to bridge grpc server with web client, after the first call the first part of the log is output, the second call leads to a crash ./grpcwebproxy-v0.9.1-linux-x86_64 --backend_addr=10.251.177.181:50051 --run_tls_server=false --allow_all_origins

    What you expected to happen Sweet working grpc-web proxy.

    How to reproduce it (as minimally and precisely as possible): The intention is to replace envoy for some setups in the for the following product. Server: https://github.com/volvo-cars/signalbroker-server Client: https://github.com/volvo-cars/signalbroker-web-client

    Full logs to relevant components

    Logs

    ./grpcwebproxy-v0.9.1-linux-x86_64 --backend_addr=10.251.177.181:50051 --run_tls_server=false --allow_all_origins --backend_max_call_recv_msg_size=5242880 --use_websockets
    INFO[0000] dialing to target with scheme: ""             system=system
    INFO[0000] using websockets                             
    INFO[0000] ccResolverWrapper: sending new addresses to cc: [{10.251.177.181:50051 0  <nil>}]  system=system
    INFO[0000] listening for http on: [::]:8080             
    INFO[0000] pickfirstBalancer: HandleSubConnStateChange: 0xc420099680, CONNECTING  system=system
    INFO[0000] pickfirstBalancer: HandleSubConnStateChange: 0xc420099680, READY  system=system
    INFO[0002] pickfirstBalancer: HandleSubConnStateChange: 0xc420099680, TRANSIENT_FAILURE  system=system
    INFO[0002] pickfirstBalancer: HandleSubConnStateChange: 0xc420099680, CONNECTING  system=system
    ERRO[0002] finished streaming call                       error="rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR" grpc.code=Internal grpc.method=GetConfiguration grpc.service=base.SystemService grpc.start_time="2019-04-17T15:49:47+02:00" grpc.time_ms=3 span.kind=server system=grpc
    INFO[0002] pickfirstBalancer: HandleSubConnStateChange: 0xc420099680, READY  system=system
    
    
    panic: close of closed channel
    
    goroutine 30 [running]:
    github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport.(*Stream).finish(...)
            /Users/jonny/Projects/grpc-web/src/github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport/transport.go:400
    github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport.(*http2Client).handleGoAway(0xc420085680, 0xc4201b6f60)
            /Users/jonny/Projects/grpc-web/src/github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport/http2_client.go:1024 +0x1c6
    github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport.(*http2Client).reader(0xc420085680)
            /Users/jonny/Projects/grpc-web/src/github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport/http2_client.go:1203 +0x4f1
    created by github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport.newHTTP2Client
            /Users/jonny/Projects/grpc-web/src/github.com/improbable-eng/grpc-web/vendor/google.golang.org/grpc/transport/http2_client.go:272 +0xbf1
    

    Anything else we need to know Thanks a lot, hope this can be our natural envoy replacer for ARM enviroments.

    Server is written in Elixir and uses: https://github.com/elixir-grpc/grpc Bridging works well using envoy (which we would like to replace for ARM targets)

    opened by AleksandarFilipov 20
  • grpc.WrappedGrpcServer.ServerHTTP() returns response with invalid Content-Type header

    grpc.WrappedGrpcServer.ServerHTTP() returns response with invalid Content-Type header

    When wrapping grpc.Server in type grpc.WrappedGrpcServer using package github.com/improbable-eng/grpc-web/go/grpcweb, the method ServeHTTP does not set a Content-Type header either to application/grpc-web-text or application/grpc-web. This causes a javascript client using protobuf generated files with https://github.com/grpc/grpc-web package to skip processing the response from the gRPC server. As a result, a callback function on the request method or on stream data event are not getting called even though the entire request is completed successfully (in case of unary request) or ongoing (in case of server-side streaming).

    This behaviour of grpc.WrappedGrpcServer is manifested both when using a unary request and server-side streaming. Also the result is the same regardless of the mode the javascript files are generated with (grpcwebtext or grpcweb).

    I am using the latest https://github.com/grpc/grpc-web library (1.0.3) and the latest version of github.com/improbable-eng/grpc-web/go/grpcweb package

    opened by danilvpetrov 20
  • Eliminate custom header x-grpc-web

    Eliminate custom header x-grpc-web

    As far as I can tell, there is no actual functional purpose for the header x-grpc-web, aside from a vanity bump that it is possible to detect use of Improbable's gRPC web client.

    Why is the header added? Of course there are significant problems with this approach. If gRPC web is being used cross-domain, the x-grpc-web header must be included in the Access-Control-Allow-Headers response. And, naturally, the custom header triggers a CORS pre-flight which costs an entire HTTP round-trip, and is a head-of-line blocker for initial calls to the server.

    So, here is my question:

    1. Why was this header added in the first place?
    2. Perhaps related to point 1, does this header actually trigger any functionality? Is it triggered when using Improbable's server side tools, or all gRPC servers?
    3. Why can't it be disabled, since the library works fine if the header is eliminated?
    question has-pr breaking-change 
    opened by sgammon 20
  • Proxy: Correct Content-Type in response

    Proxy: Correct Content-Type in response

    The Content-Type header in the request is automatically changed from application/grpc-web to application/grpc, however, no corresponding conversion is done for response headers and trailers. This commit adds this functionality, both to early headers and to the in-body trailers.

    Found while writing my own WASM gRPC-Web client in Go (in a fork of grpc/grpc-go).

    opened by johanbrandhorst 20
  • Use Go 1.11 modules

    Use Go 1.11 modules

    Including bumping of a few deps which now also have modules support (this gets rid of some // indirect lines):

    • github.com/grpc-ecosystem/go-grpc-middleware
    • github.com/grpc-ecosystem/go-grpc-prometheus
    • github.com/rs/cors

    Did not bump any other deps, upgrades can be listed with go list -m -u all from the root folder.

    Fixes #202.

    opened by maxekman 19
  • Is Typescript totally necessary?

    Is Typescript totally necessary?

    I am wondering if this can be made to use with plain ES5 javascript without the typescript bits. I tried for a while to integrate it in a normal ReactJS workflow but I could not do it without TS

    opened by jeffwillette 18
  • Bump loader-utils from 2.0.0 to 2.0.4 in /client/grpc-web-react-example

    Bump loader-utils from 2.0.0 to 2.0.4 in /client/grpc-web-react-example

    Bumps loader-utils from 2.0.0 to 2.0.4.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.4

    2.0.4 (2022-11-11)

    Bug Fixes

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)

    v2.0.2

    2.0.2 (2021-11-04)

    Bug Fixes

    • base64 generation and unicode characters (#197) (8c2d24e)

    v2.0.1

    2.0.1 (2021-10-29)

    Bug Fixes

    Changelog

    Sourced from loader-utils's changelog.

    2.0.4 (2022-11-11)

    Bug Fixes

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)

    2.0.2 (2021-11-04)

    Bug Fixes

    • base64 generation and unicode characters (#197) (8c2d24e)

    2.0.1 (2021-10-29)

    Bug Fixes

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies size/XXL javascript 
    opened by dependabot[bot] 0
  • Bump loader-utils from 2.0.0 to 2.0.4 in /client/grpc-web

    Bump loader-utils from 2.0.0 to 2.0.4 in /client/grpc-web

    Bumps loader-utils from 2.0.0 to 2.0.4.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.4

    2.0.4 (2022-11-11)

    Bug Fixes

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)

    v2.0.2

    2.0.2 (2021-11-04)

    Bug Fixes

    • base64 generation and unicode characters (#197) (8c2d24e)

    v2.0.1

    2.0.1 (2021-10-29)

    Bug Fixes

    Changelog

    Sourced from loader-utils's changelog.

    2.0.4 (2022-11-11)

    Bug Fixes

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)

    2.0.2 (2021-11-04)

    Bug Fixes

    • base64 generation and unicode characters (#197) (8c2d24e)

    2.0.1 (2021-10-29)

    Bug Fixes

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies size/XXL javascript 
    opened by dependabot[bot] 0
  • Bump loader-utils from 1.4.0 to 1.4.2 in /integration_test

    Bump loader-utils from 1.4.0 to 1.4.2 in /integration_test

    Bumps loader-utils from 1.4.0 to 1.4.2.

    Release notes

    Sourced from loader-utils's releases.

    v1.4.2

    1.4.2 (2022-11-11)

    Bug Fixes

    v1.4.1

    1.4.1 (2022-11-07)

    Bug Fixes

    Changelog

    Sourced from loader-utils's changelog.

    1.4.2 (2022-11-11)

    Bug Fixes

    1.4.1 (2022-11-07)

    Bug Fixes

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies size/XXL javascript 
    opened by dependabot[bot] 0
  • Bump socket.io-parser from 4.0.4 to 4.0.5 in /integration_test

    Bump socket.io-parser from 4.0.4 to 4.0.5 in /integration_test

    Bumps socket.io-parser from 4.0.4 to 4.0.5.

    Release notes

    Sourced from socket.io-parser's releases.

    4.0.5

    Bug Fixes

    • check the format of the index of each attachment (b559f05)

    Links

    Changelog

    Sourced from socket.io-parser's changelog.

    4.0.5 (2022-06-27)

    Bug Fixes

    • check the format of the index of each attachment (b559f05)

    4.2.0 (2022-04-17)

    Features

    • allow the usage of custom replacer and reviver (#112) (b08bc1a)

    4.1.2 (2022-02-17)

    Bug Fixes

    • allow objects with a null prototype in binary packets (#114) (7f6b262)

    4.1.1 (2021-10-14)

    4.1.0 (2021-10-11)

    Features

    • provide an ESM build with and without debug (388c616)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies size/XXL javascript 
    opened by dependabot[bot] 0
  • ReferenceError: self is not defined when trying to call a grpc-web function from a CLI/server application

    ReferenceError: self is not defined when trying to call a grpc-web function from a CLI/server application

    Hi!

    I'm encountering an issue that is probably related to: https://github.com/improbable-eng/grpc-web/pull/728 I'm not sure if this related to grpc-web, but wanted to make sure that the use case is supported. I'm trying to create a server that interacts with another server via grpc-web.

    Here's my code:

    import express, { Express, Request, Response } from 'express';
    import dotenv from 'dotenv';
    import * as gauth from 'google-auth-library';
    ​
    import { MyServiceClient } from '../../src/ui/client/src/proto/my_pb_service';
    import * as pb from '../../src/ui/client/src/proto/my_pb';
    import { Observable } from 'rxjs';
    ​
    dotenv.config();
    ​
    const app: Express = express();
    const port = process.env.PORT;
    ​
    app.get('/', (req: Request, res: Response) => {
      var empty: string[];
      empty = [];
      res.send('Express + TypeScript Server');
    ​
      console.log("creating client")
      let r = new pb.CollectAndScanRequest();
      r.setResourceGroupNamesList(empty);
      var client = new MyServiceClient('https://my-dev.backend.url/api')
    ​
      console.log("client created")
      client.collectAndScan(r, (err, res) => {
        if (err !== null) {
          console.error(`collectAndScanAll: ${err}`);
        }
        if (res === null) {
          console.error(`collectAndScanAll: unexpected null response`);
        }
        console.log(`collectAndScanAll: ${res}`);
      });
      console.log("Done")
    });
    ​
    app.listen(port, () => {
      console.log(`⚡️[server]: Server is running at https://localhost:${port}`);
    });
    

    Here's the error I see:

    creating client
    client created
    ReferenceError: self is not defined
        at new e (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:16017)
        at REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:15931
        at REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:15942
        at o (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:15312)
        at t.makeDefaultTransport (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:15405)
        at e.createTransport (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:8356)
        at new e (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:7911)
        at t.client (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:7619)
        at t.unary (REDACTED/src/ui/client/node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js:1:24075)
        at MyServiceClient.collectAndScan (REDACTED/src/ui/client/src/proto/my_pb_service.js:60:21)
    

    Now, I'm new to TS/JS so this error and trace log is not really helpful for me. It could also be related to instantiating the grpc client, but then, I copied this from a working webfrontend code.

    Does grpc-web support non browser invocation? Could this be related to webpack config? Given there is a PR for something similar, how/where would I need to define self?

    opened by bt-nia 1
  • Status codes and error messages are displayed incorrectly on the angular client.

    Status codes and error messages are displayed incorrectly on the angular client.

    I am using the following code to get the result of executing a unary grpc request from a client.

    client.login(req, (error, response) => {
          if (response != null) {
            this.tokenService.saveToken(response.getAccesstoken());
          }
          else{
            alert("Error code: " + error?.code + "Message: " + error?.message);
          }
        });
    

    When the server just returns the result, then everything works as it should. But if the server should return an error, then no matter what status code and message the server returns, this code always outputs the following line:

    Error code: 2 Message: Response closed without grpc status (headers only)

    At the same time, I'm testing the API using the Kreya tool (In normal gprc mode and in grpc-web mode). In this program, all status codes and error messages are displayed correctly.

    On the backend I use ASP.NET Core with Grpc.AspNetCore.Web nuget package to support grpc-web

    What could be the matter that the error status code and the message are always the same?

    opened by Quttar 1
Releases(v0.15.0)
Owner
Improbable Engineering
Open Source projects maintained by Improbable's Engineering division.
Improbable Engineering
Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Joram Wambugu 0 Nov 24, 2021
Simple grpc web and grpc transcoding with Envoy

gRPC Web and gRPC Transcoding with Envoy This is a simple stand-alone set of con

null 0 Dec 25, 2021
Example of strongly typed go/graphql/typescript web application

go-gql-typescript-example Example of strongly typed go/graphql/typescript web application Overview This is an example web application. On the server i

null 2 May 27, 2022
Raft-grpc-demo - Some example code for how to use Hashicorp's Raft implementation with gRPC

raft-grpc-example This is some example code for how to use Hashicorp's Raft impl

dougsong 1 Jan 4, 2022
A simple FTP protocol with client and server implemented in TypeScript and Golang

websocket-ftp A simple FTP protocol with client and server implemented in TypeScript and Golang. Example (Client) const buffer: Uint8Array = (new Text

LQR471814 0 Apr 14, 2022
Go-grpc - This is grpc server for golang.

go-grpc This is grpc server for golang. protocのインストール brew install protoc Golang用のプラグインのインストール go install google.golang.org/protobuf/cmd/protoc-gen-go

jotaro yuza 1 Jan 2, 2022
Go-grpc-template - A small template for quickly bootstrapping a, developer platform independent gRPC golang application

go-grpc-template A small template for quickly bootstrapping a developer platform

null 1 Jan 20, 2022
Transform Golang `enum` type to Typescript enum

golang-enum-to-ts Transform Golang enum type to Typescript enum Function Before (Golang) package some type Status int const ( Todo Status = iota D

小安 2 Mar 1, 2022
Generate Typescript types from Golang source code

?? tygo Tygo is a tool for generating Typescript typings from Golang source files that just works. Other than reflection-based methods it preserves co

Guido Zuidhof 301 Nov 21, 2022
Group peer to peer video calls for everyone written in Go and TypeScript

Peer Calls v4 WebRTC peer to peer calls for everyone. See it live in action at peercalls.com. The server has been completely rewriten in Go and all th

Peer Calls 1.1k Nov 21, 2022
A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.

grpc-tools A suite of tools for gRPC debugging and development. Like Fiddler/Charles but for gRPC! The main tool is grpc-dump which transparently inte

Bradley Kemp 1.1k Nov 25, 2022
grpc-http1: A gRPC via HTTP/1 Enabling Library for Go

grpc-http1: A gRPC via HTTP/1 Enabling Library for Go This library enables using all the functionality of a gRPC server even if it is exposed behind a

StackRox 88 Nov 20, 2022
Go based grpc - grpc gateway micro service example

go-grpc-gateway-server This repository provides an example for go based microservice. Go micro services developed based on gRPC protobuf's and also us

Suresh Yekasiri 0 Dec 8, 2021
GRPC - Creating a gRPC service from scratch

#Go gRPC services course Creating a gRPC service from scratch Command line colle

Rafael Diaz Miles 1 Jan 2, 2022
Totem - A Go library that can turn a single gRPC stream into bidirectional unary gRPC servers

Totem is a Go library that can turn a single gRPC stream into bidirectional unar

Joe Kralicky 2 Oct 12, 2022
Grpc-gateway-map-null - gRPC Gateway test using nullable values in map

Demonstrate gRPC gateway behavior with nullable values in maps Using grpc-gatewa

null 1 Jan 6, 2022
Todo-app-grpc - Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, etc)

Go/GRPC codebase containing RealWorld examples (CRUD, auth, advanced patterns, e

Sammi Aldhi Yanto 5 Oct 12, 2022
GRPC - A client-server mockup, using gRPC to expose functionality.

gRPC This is a mockup application that I built to help me visualise and understand the basic concepts of gRPC. In this exchange, the client can use a

Fergal Bittles 0 Jan 4, 2022
Benthos-input-grpc - gRPC custom benthos input

gRPC custom benthos input Create a custom benthos input that receives messages f

Marco Amador 3 Sep 26, 2022