fullstorydev / grpcui Goto Github PK
View Code? Open in Web Editor NEWAn interactive web UI for gRPC, along the lines of postman
License: MIT License
An interactive web UI for gRPC, along the lines of postman
License: MIT License
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.)
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.
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?
@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.
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.
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
grpcui/internal/resources/webform/webform.js
Lines 360 to 361 in 20f4101
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.
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
Is there a plan to add collections, similar to what postman has?
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
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
Great project!!
Trying to alter some javascript, but it seems i need go-bindata for this.
Is go-bindata still working for this project?
Since i am not a go-expert i am a bit stuck on this for now.
Some GO-expert might add a section in the README on how to re-compile the assets?
Kind regards,
Using latest go version go1.12.5 linux/amd64 on ubuntu 18.04.2
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.
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).
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:
vs
in my case I'm seeing same received parameters on my grpc server.
Is there any way to be able to send empty strings?
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
Would it be possible to have an option to automatically open the url the default browser? That would be a time saver instead of copy and pasting it
As a user operating on a gRPC server with many services or a gRPC service with many methods, I'd like to find what I need without having to go through a long list.
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)
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 ?
$ 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
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.
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?
many thanks for this work. terrifically useful to me.
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
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.
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
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
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?
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!
As the docs say, -reflect-header
s 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?
As an operator without access to the original protos, I would like to see protobuf comments within the grpcui
web form in order to have more context when entering data.
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:
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.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.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.It will be great to have an example of how to use the standalone application.
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).
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.
There are currently three Docker images that wrap grpcui.
It would be nice to have also an official Docker image that would be automatically released when new release of grpcui is made.
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:
paths
property to be top level instead of having it neststring[]
approach for any edge casesExample
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.
The max-time
argument from grpcurl is missing. It's useful in allowing us to set the timeout for all calls.
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?
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.
Loading request from history works well, but not for metadata.
Is it known issue?
as per https://developers.google.com/protocol-buffers/docs/proto3#scalar fixed32 is an unsigned int and should accept values upto 4,294,967,295.
But the validation stops us from entering values greater than 2,147,483,647.
source:
grpcui/internal/resources/webform/webform.js
Line 1081 in 20f4101
same error in java:
grpc/grpc-java#5040
My response comes with google.protobuf.Timestamp which I fill in with seconds and nanoseconds. When displayed in grpcui, I get 3 hours less time. This problem seems to be timezone related, is there a way to set the timezone or some other way to solve my problem?
If the gRPC server returns a response with +/- Infinity double values, grpcui presents a javascript error with Unexpected error: parsererror
.
Debugging through the code, it seems to be failing at this particular line, most likely because it doesn't recognize the Infinity values as valid json double values.
There is currently a way to show the raw JSON for the requests that will be sent. Ideally, we could do the same thing for response data (which currently is only rendered in an HTML form).
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.
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.
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.