Giter Club home page Giter Club logo

grpcui's People

Contributors

2yuri avatar colega avatar dependabot[bot] avatar dragonsinth avatar gerektoolhy avatar gpassini avatar gtg471h avatar gubtos avatar hojongs avatar ismaildawoodjee avatar james-bartman avatar jerome-quere avatar jhump avatar johanbrandhorst avatar jtsai-dev avatar kohenkatz avatar lemmerelassal avatar maximus1108 avatar nordicdyno avatar rokostik avatar sanjaybv avatar termie avatar thejenix avatar thempatel avatar wolfogre avatar xwjdsh avatar y-yagi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grpcui's Issues

Ability to view RPC history

If the details of each RPC invocation were include in the program output/logs, it could provide great utility for someone that wants to go back to previous RPCs they've sent in the same grpcui session. This would be particularly slick if they were in the form of grpcurl invocations (see #3) and could be easily pasted into any other grpcui session.

It might also be nice to have this sort of history in the browser -- maybe saved to local storage so that refreshing the page doesn't forget it all. (Use of local storage would likely need to be opt-in, so other places where the form is embedded could disable that to make sure it can't interfere with the host page.)

Need tests for JS code

This repo includes about 2k lines of JavaScript code (most of the actual logic for the web UI), but does not have any JS tests (or even a JS test harness). We'll likely want to use PhantomJS or similar, since the JS code needs to run in the context of a browser and interact with page DOM elements.

"module google.golang.org/grpc@latest found (v1.32.0), but does not contain package google.golang.org/grpc/xds/experimental"

As the title says, upon trying to go get github.com/fullstorydev/grpcui/...

I am greeted with the following output

go: downloading github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
go: finding module for package google.golang.org/grpc/xds/experimental
go: finding module for package google.golang.org/grpc/xds/experimental
C:\Users\[username]\go\pkg\mod\github.com\fullstorydev\[email protected]\grpcurl.go:35:2: module google.golang.org/grpc@latest found (v1.32.0), but does not contain package google.golang.org/grpc/xds/experimental

I've no clue really what this error means, can anyone point me in the right direction?

Reflection throws error when targeting Google.Protobuff 3.9

@jhump this is not an issue against your project but I figured it's worth mentioning here in case others have upgraded to Protobuff 3.9 and can't run GRPCUI.

In short, if a GRPC server gets upgraded to use Protobuf 3.9 (latest version, released 4 days ago) and you try to run GRPCUI against it, reflection fails with error:

Method not found: 'Google.Protobuf.FieldCodec<Google.Protobuf.ByteString> Google.Protobuf.FieldCodec.ForBytes(UInt32)'.

I believe this is a result of an issue introduced in 3.9 and that is documented by the Protobuf team here.

Command-line options to set max message size for channel

Hi everyone,
I'm trying to get ByteString from server with content length is larger than max (6221671 vs. 4194304). With client in C# i'm using ChannelOptions with key is grpc.max_receive_message_length to set max length and can receive large file from Server. So in grpcUI how can i do that?

Thank for your help.

Support file upload for bytes fields

Would you be open to an MR to show a file upload in addition to the current base64 encoded textbox for bytes fields?

The implementation requires following changes:

Change the switch case to a different render method addBytesToForm

case "bytes": case "google.protobuf.BytesValue":
return addStringToForm(container, parent, value, fld, true);

This addBytesToForm would show two inputs, a string and a file button. The string would behave as it does and the file button would handle onchange to populate a base64 encoded byte string (which is set on the message and the string input).

I can put together a quick MR for this.

Install program

I have problems when install grpcui

cannot find package "github.com/cncf/udpa/go/udpa/core/v1" in any of:
        c:\go\src\github.com\cncf\udpa\go\udpa\core\v1 (from $GOROOT)
        C:\Users\<user>\go\src\github.com\cncf\udpa\go\udpa\core\v1 (from $GOPATH)

I found in cncf repository one change and exists another version without /v1 directory on master. @v0.0.1 is ok. But I'm no programming in Go to correct that

Request metadata is not loaded when load history

Hi, i am big fan of grpcui.

I am using a lot of request (that include sort of request-metadatas).
So I use history loading feature many times.

But request-metadata is not loading. And it is very inconvenient for me.

Reproduce step

  • Send request with request metadata
    image
  • Click history and load (we can key metadata list in this page)
    image
  • Request metdata disappear
    image

Yocto integration

Hello,

I have a gRPC server running on an embedded target, built using Yocto. I wanted to use a debug website on the target so I can easily debug certain behavior which is linked to the gRPC Service. I've been able to run everything native perfectly, but when I wanted to integrate this project in Yocto I've had a bunch of issues: like not being able to find grpc-go (which is supported by openembedded).

Anyone any experience with this? Or can someone give some things I could look into?

Thanks a lot for the help!

Goran Broeckaert

use URL hash fragment to pin UI to a particular state

Currently, refreshing the grpcui page -- for example, to re-query for the remote service definition if the server is restarted with changes to its protocol -- resets everything. It changes tab to the request form, which gets blanked out. The service and method name drop-downs revert to whatever item is first in the list, instead of remembering what was previously selected.

It would be much nicer if the UI recorded its state in a hash fragment in the URL and could then reconstitute the UI state from that fragment when the page is loaded. That way, refreshing does not lose any of the data already entered.

Releases?

Heya! Thanks for sharing this project, I immediately fell in love ๐Ÿ˜

What do you think about having releases? It would simplify packaging this up with; I'd like to create a habitat package similar to the one we have for grpcurl (see also habitat-sh/core-plans#2186).

unable to send empty strings

I have a service where a certain field is a string and can be empty.

If I send a request through grpcui using an empty string, my grpc service does not receive that field at all.

I'd expect to see a difference between:

  • field checkbox enabled in grpui but field empty: my grpc service should receive empty value for that field
    image

vs

  • field checkbox not enbled in grpui: my grpc service should not receive such field

image

in my case I'm seeing same received parameters on my grpc server.

Is there any way to be able to send empty strings?

Nodejs supporting

gRPC server is written by NodeJS. I have an issue with connecting.

Failed to compute set of methods to expose: server does not support the reflection API

Can't use negative values on int64

I can see in my local machine the commit (#29) that should fix this but I can't get it to work. I've tried deleting and installing again, but nothing works. Am I missing something?

facundo:grpcui facundomedica$ git log
commit 20f41010374fb569638f2d094776e27ffd1a0634 (HEAD -> master, origin/master, origin/HEAD)
Author: Joshua Humphries <[email protected]>
Date:   Tue Mar 26 14:46:20 2019 -0400

    fix range validation for 64-bit signed ints (#29)

grpcui: command not found

I followed Installation and installed grpcui

go get github.com/fullstorydev/grpcui/...
go install github.com/fullstorydev/grpcui/cmd/grpcui

I also setted grpcui in my $PATH. I even tried with downloading this repo and make install. But I keep getting error grpcui: command not found. Anyone could help ?

Unable to install

$ go get github.com/fullstorydev/grpcui
...
$ go install github.com/fullstorydev/grpcui/cmd/grpcui
# github.com/fullstorydev/grpcurl
../go/src/github.com/fullstorydev/grpcurl/grpcurl.go:600:4: undefined: grpc.WithContextDialer

must restart grpcui when connection to server is lost

If I start both grpcui and a gRPC server and then have to restart the gRPC server, the grpcui program gets into a bad state and must also be restarted.

The problem is due to the use of the original dial context in the custom dialer (in grpcurl's BlockingDial function), even for subsequent connect operations. So when the gRPC client in grpcui tries to re-establish a connection, it is using an expired context and so can never successfully reconnect.

This is fixed in the latest version of grpcurl. So we need a new release of grpcurl so that grpcui can depend on it in its go.mod file.

Support for Oauth

I am protecting my APIs with oauth2 token, is there any way to make the authentication process and storage the id_token to send as metadata to my APIs?

wow. thanks.

many thanks for this work. terrifically useful to me.

standalone sub-path

handling at a sub-path via http.StripPrefix returns a 301 permanent redirect instead

It works with no sub-path and no StripPrefix.

to reproduce with go version go1.12.3 windows/amd64:

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"time"

	"golang.org/x/net/context"

	"github.com/fullstorydev/grpcui/standalone"
	"github.com/fullstorydev/grpcurl"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials"
)

var (
	port   string
	target string
)

func init() {
	port = os.Getenv("PORT")
	if port == "" {
		port = "8000"
	}
	target = os.Getenv("TARGET")
}

func main() {
	ctx := context.Background()
	dialTime := 10 * time.Second
	ctx, cancel := context.WithTimeout(ctx, dialTime)
	defer cancel()
	var opts []grpc.DialOption
	var creds credentials.TransportCredentials
	network := "tcp"
	cc, err := grpcurl.BlockingDial(ctx, network, target, creds, opts...)
	if err != nil {
		log.Fatalf("Failed to dial target host %q", target)
	}
	h, err := standalone.HandlerViaReflection(ctx, cc, target)
	if err != nil {
		log.Fatalf("Reflection failed on target host %q", target)
	}
	http.Handle("/grpcui/", http.StripPrefix("/grpcui/", h))
	log.Fatal(http.ListenAndServe(":"+port, nil))
}
$ curl -v localhost:8000/grpcui/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET /grpcui/ HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.63.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Content-Type: text/html; charset=utf-8
< Location: /
< Set-Cookie: _grpcui_csrf_token=<------------------------------------->
< Date: Thu, 27 Jun 2019 22:55:17 GMT
< Content-Length: 36
<
<a href="/">Moved Permanently</a>.

* Connection #0 to host localhost left intact

Error: Cant find package

Due to recent changes to introduce the github.com/pkg/browser and golang.org/x/crypto/ssh/terminal
I get error while build it from dockerfile Step 8/14 : RUN go install github.com/fullstorydev/grpcui/cmd/grpcui ---> Running in dbe088db5baa src/github.com/fullstorydev/grpcui/cmd/grpcui/grpcui.go:25:2: cannot find package "github.com/pkg/browser" in any of: /usr/local/go/src/github.com/pkg/browser (from $GOROOT) /go/src/github.com/pkg/browser (from $GOPATH) src/github.com/fullstorydev/grpcui/cmd/grpcui/grpcui.go:26:2: cannot find package "golang.org/x/crypto/ssh/terminal" in any of: /usr/local/go/src/golang.org/x/crypto/ssh/terminal (from $GOROOT) /go/src/golang.org/x/crypto/ssh/terminal (from $GOPATH)

Can you please help figuring out why is this happening.

Symbol not found: grpc.reflection.v1alpha.ServerReflection

On a server with reflection enabled (works fine with both grpcurl and grpcox), I get this error when running grpcui:

$ grpcui -vvv -bind 0.0.0.0 -port 8082 -plaintext localhost:4567
INFO: 2019/06/14 10:49:37 parsed scheme: ""
INFO: 2019/06/14 10:49:37 scheme "" not registered, fallback to default scheme
INFO: 2019/06/14 10:49:37 ccResolverWrapper: sending update to cc: {[{localhost:4567 0  <nil>}] }
INFO: 2019/06/14 10:49:37 ClientConn switching balancer to "pick_first"
INFO: 2019/06/14 10:49:37 pickfirstBalancer: HandleSubConnStateChange: 0xc00006ee30, CONNECTING
INFO: 2019/06/14 10:49:37 pickfirstBalancer: HandleSubConnStateChange: 0xc00006ee30, READY
Failed to compute set of methods to expose: Symbol not found: grpc.reflection.v1alpha.ServerReflection

The grpcui interface opens without anything

image

This is my proto file

syntax = "proto3";

package proto.TestService.v1;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/api/annotations.proto";

option go_package = "api";
option (gogoproto.goproto_getters_all) = false;

service SearchService {
    rpc Search(SearchRequest) returns (SearchResponse) {
        option (google.api.http) = {
            get:"/abc/say_hello"
        };
    }
}

message SearchRequest {
    string request = 1 [(gogoproto.moretags)='form:"request" validate:"required"'];
}

message SearchResponse {
    string response = 1 [(gogoproto.jsontag) = 'response'];
}

My run command

 grpcui -import-path=E:/GOPATH/src/github.com/bilibili/kratos/third_party -proto=E:/GOPATH/src/github.com/bilibili/kratos/third_party/github.com/gogo/protobuf/gogoproto/gogo.proto -plaintext 127.0.0.1:9001

Service startup code

package main

import (
	"context"
	pb "kratos-demo/api"
	"log"
	"net"

	"google.golang.org/grpc/reflection"

	"google.golang.org/grpc"
)

type SearchService struct{}

func (s *SearchService) Search(ctx context.Context, r *pb.SearchRequest) (*pb.SearchResponse, error) {
	return &pb.SearchResponse{Response: "1111  Server"}, nil
}

const PORT = "9001"

func main() {
	server := grpc.NewServer()
	pb.RegisterSearchServiceServer(server, &SearchService{})
	lis, err := net.Listen("tcp", ":"+PORT)
	if err != nil {
		log.Fatalf("net.Listen err: %v", err)
	}
	reflection.Register(server)
	server.Serve(lis)
}

Looking forward to the answer to the question

Deploy grpcui with the grpc service

The grpc ui works great and I am able to access my service, but I am looking for a an alternate solution of if there is a way to deploy the toll with my grpc service itself, so that anyone can readily access it rather than every person install the tool locally.

What changes will I need to do to achieve that. Any anyone tried anything similar?

run grpcui and got "Symbol not found: grpc.health.v1.Health"

hello,
I run grpcui 1.0.0 release on Windows and it failed.
E:>grpcui.exe -plaintext 127.0.0.1:50051
Failed to compute set of methods to expose: Symbol not found: grpc.health.v1.Health

but there is a grpc.health.v1.Health service, grpcurl can list it out.
E:>grpcurl.exe -plaintext 127.0.0.1:50051 list
grpc.health.v1.Health
grpc.reflection.v1alpha.ServerReflection
my_grpc.my_grpc_service

the service is wroten c++, almost same as the grpc example greeter_server.cc,
does anyone known how to resolve this issue?
thank you!

Specify headers to use regardless of reflection

As the docs say, -reflect-headers are only used for reflection requests:

These headers will only be used during reflection requests

Is there a way to pass headers that get used regardless?

CSRF protection

The main package needs some way for embedded forms to enable CSRF protection. The standalone package (and thus the grpcui command-line tool, too) then need to use that mechanism to enable CSRF protection.

Initial idea on how to solve:

  1. Provide a func(r *http.Request) string function to grpcui.RPCInvokeHandler. If supplied, the handler will look for a custom header (X-CSRF-Token?) and make sure it matches the string returned by the given function.
  2. Update grpcui.WebFormScript to expose API (e.g. add exported functions to window) that can be used to set a CSRF token. If set, all calls to invocation handler will add it in custom header.
  3. In the standalone package, use a JS-visible cookie to track the CSRF token. When the main page is fetched, set the cookie if it's not present, generating new tokens using a secure RNG. The custom function given to grpcui.RPCInvokeHandler will retrieve the cookie value (and fail with a 401 Unauthorized if it does not exist). In the main page, in which the gRPC form is embedded, add a <script> tag that queries the cookie value and then calls the script's exported function to set its CSRF token.

Option to set the host and port from the web UI

At the moment, the host and port need to be specified on the command line, which makes it impossible to deploy an instance of gRPC UI somewhere and just use it when needed (at least if you work with multiple projects/environments).

Input fixed request metadata when execute grpcui

Hi!
In our project,
All requests require token in request-metadata for security

There is node A (grpc server), node B (grpcui)
node A and node B knows the token (by environment variable).
But user that connected to node B don't know the token.

User can't use grpcui (b/c node A require token for all requests, and they don't know the token)

So I want when execute grpcui, can input fixed request metdata.

For example, make new parameter -metadata key:value

grpcui -metadata token:password -metadata other_token:other_password localhost:8888

Thanks for reading.

Support for google.protobuf.FieldMask well known type

Consider supporting FieldMask in a more advanced way by allowing you to select the properties of a message that should be included.

Some nice to have options and things to consider:

  1. Flatten the paths property to be top level instead of having it nest
  2. The ability to switch back to the string[] approach for any edge cases
  3. The ability to specify which message/property the fields are relative to
  4. Maybe a set from request button that creates a FieldMask paths from all the included fields you've already filled out in your request

Example
My API has a pattern where resource update methods look like UpdateFoo(UpdateFooRequest).

message UpdateFooRequest {
  Foo foo = 1;
  // fields relative to foo
  google.protobuf.FieldMask update_mask = 2;
  // ... other update metadata
}

Which allows for updating specific fields in the resource (Foo in this case), I thought more advanced support for FieldMask would help out.

retry upstream connection

I'm using grpcui in a docker-compose app. I've got a bit of a race condition where the upstream gRPC server often doesn't start before grpcui attempts to connect to it. I'm using docker-compose depends_on, but this doesn't work because the container with the gRPC service reports ready when the server process has started, and not when the server is actually ready to receive connections. There's normally a few seconds in it.

Grpcui is making one attempt to connect to the upstream service, and then exiting with an error code. What i'd really like is a way to specify that it should retry the upstream connection. Is there a clean way to do this?

Copy as "grpcurl"

A slick feature would be to be able to Copy as 'grpcurl' -- which would extract all connection info from command-line flags as well as the request metadata and data in the web form and use that to generate an equivalent grpcurl command.

Similarly, the ability to paste a grpcurl command, and have that auto-populate the metadata and request message data would be slick as well.

master not tagged

Any reason master has changes that aren't reflected in the latest tag? Go mod is fetching v1.0.0, but underlying changes in the import chain (grpcui -> grpcurl -> grpc-go) have breaking changes.

github.com/fullstorydev/grpcui/standalone imports
        github.com/fullstorydev/grpcui imports
        github.com/fullstorydev/grpcurl imports
        google.golang.org/grpc/xds/experimental: module google.golang.org/grpc@latest (v1.33.0) found, but does not contain package google.golang.org/grpc/xds/experimental

It looks like v1.0.0 depends on v1.6.0 of grpcurl, which has this line (https://github.com/fullstorydev/grpcurl/blob/v1.6.0/grpcurl.go#L35). You fixed it starting in v1.6.1, but no tagged version of this library has the fix.

Incompatible with validators

Tested with both github.com/mwitkow/go-proto-validators and github.com/envoyproxy/protoc-gen-validate/, it all failed with File not found errors.

This is caused by these validators lib not registering themselves into reflection. However, these protos are used in field/method options, and in fact not actual dependencies to make the GRPC call.

Our current workaround is to fork the underlying project jhump/protoreflect, and provide an opt-out option to ignore failure to reflect these lib.

Looking forward to a better solution.

[feature request] connect to multiple grpc services

This is a really good grpc frontend! I was planning to use it as a debugging/curl style hub for all our grpc backends. The problem I saw is that to support multiple backends, one has to run the command for each grpc service, and then expose it to different ports if the grpcui instances are deployed in one container.

Is it possible to connect to multiple grpc services with single exposed port and united UI? Is it possible for the UI to consolidate and support the selection for which service we want to talk to?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.