SafetyCulture / grpc-web-devtools

Chrome & Firefox Browser extension to aid gRPC-Web development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gRPC-Web Developer Tools conflicts with unary interceptors introduced by grpc/grpc-web

bassbeaver opened this issue · comments

I'v found that enabled gRPC-Web Developer Tools (by SafetyCulture) brokes up unary interceptors set up for grpc-web client. Interceptors are being not called when gRPC-Web Developer Tools are enabled.

Issue was found with next code:

const AuthInterceptor = function() {
    this.intercept = function(request, invoker) {
        request.getMetadata().Authorization = AuthService.GetAuthHeaderValue();

        return invoker(request);
    };
};

const options = {"unaryInterceptors": [new AuthInterceptor()]};
const APIClient = new APIPromiseClient(API_URL, null, options);

const enableDevTools = window.__GRPCWEB_DEVTOOLS__ || (() => {});
enableDevTools([
    APIClient,
]);


APIClient.me(new ProtobufEmpty(), {})
    .then(result => {
        ...
    })
    .catch(error => {
        console.error(error);    // <-- when gRPC-Web DevTools are enabled I receive error "no auth header" from my backend
    });

this will fix it #79

merged this change into my fork's master and updated the readme to reflect the change. I'm dropping a link here for anyone that finds this and wants to use native gRPC-Web interceptors:
https://github.com/jrapoport/grpc-web-devtools

We operate in a corporate environment so all of our chrome extensions have to be whitelisted. Therefore we aren't able to manually install the fork from @jrapoport. Anything we can do to get this fixed merged as soon as possible would be wonderful as we just currently cannot use gRPC-Web Developer Tools. Let me know if there is any way we can help.

We operate in a corporate environment so all of our chrome extensions have to be whitelisted. Therefore we aren't able to manually install the fork from @jrapoport. Anything we can do to get this fixed merged as soon as possible would be wonderful as we just currently cannot use gRPC-Web Developer Tools. Let me know if there is any way we can help.

Whitelisted as in published as a Chrome extension? If so, happy to submit it if that will unblock you.

@jrapoport, sorry for the delayed response. Unfortunately that won't help us here. The IT org has chrome locked down so we can only install extensions from their whitelist, so even if you published it, I'd have to get it through the approval process, which is a bunch of red tape. I understand their concern, there is a fair bit of malware on the chrome extension store.

I spent a lot of time figuring out why my interceptors for handling errors don't work... Please look into merging that PR :)

Can we label this? Look like "On approval" or smth

Is this repo still maintained? This issue is still valid and needs to be fixed.

Created this PR with several lines of code to fix this issue.

Facing similar issue.
Please let me know if any fix or workaround for this ?