question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error callback never invoked for some classes of server response.

See original GitHub issue

I have a grpc-web server that is returning 200 OK, and grpc-status / grpc-message, but the client javascript is failing to parse it. The observed behavior is that client requests never receive a completion callback from the library. See the request/response sample below.

The case below is likely related to: https://github.com/google/closure-library/issues/946 , however a quick review of the code suggests there may be more cases like this; unexpected server responses aren’t correctly handled.

Request URL: http://localhost:8090/derp.EchoService/Echo
Request Method: POST
Status Code: 200 OK
Remote Address: 127.0.0.1:8090
Referrer Policy: no-referrer-when-downgrade

Response Headers:
access-control-allow-credentials: true
access-control-allow-origin: null
content-length: 0
content-type: application/grpc-web+proto
date: Thu, 20 Dec 2018 19:25:32 GMT
grpc-message: upstream connect error or disconnect/reset before headers
grpc-status: 14
server: envoy
Provisional headers are shown
Content-Type: application/grpc-web+proto
grpc-timeout: 999m
Origin: null
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
X-Grpc-Web: 1
X-User-Agent: grpc-web-javascript/0.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:17

github_iconTop GitHub Comments

4reactions
QuentinBrossecommented, Dec 22, 2018

Hi @y3llowcake ! I don’t kown if my problem is in the scope of this issue but here is the explanation: I have a gRPC server written in Go, my proxy is envoy, and I use the JS client of grpc-web in this mode: import_style=commonjs,mode=grpcwebtext.

If my server resturns a gRPC error, the JS Client don’t handle the error. For example, this call returns a valid GRPC error in headers: 50375748-e3057e00-0602-11e9-8608-c7771c2e7601

but my client don’t handle it:

const signUpCall = accountClient.signUp(accountRequest, {}, (err, res) => {
    if (err) {
        console.error(err);
    }
    console.log(res);
});

signUpCall.on('status', status => console.log('status', status));
signUpCall.on('data', d => console.log('data', d));
signUpCall.on('end', d => console.log('end', d));
signUpCall.on('error', d => console.log('error', d));

(In this case, none of my console.log was called…)

What do you think ? 😃 Thanks !

3reactions
smoorsausjecommented, Feb 20, 2020

@skyjia Could you let me know what exactly the incorrect configuration was? We have been stuck with this same problem in our app and seem to have a similar environment as you do.

Thanks in advance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is server.close callback never invoked? - Stack Overflow
To test this I am making a single request which throws an error. The process is only closed after the timer expires (10...
Read more >
Better Error Handling In NodeJS With Error Classes
This article is for JavaScript and NodeJS developers who want to improve error-handling in their applications.
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
Mistake #2: Invoking a Callback More Than Once​​ This is because calling the callback doesn't automatically end the execution of the current function....
Read more >
Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >
Troubleshoot invocation issues in Lambda
Invocation errors can be caused by issues with request parameters, event structure, function settings, user permissions, resource permissions, or limits. If you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found