Skip to content

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

@bassbeaver

Description

@bassbeaver

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
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions