Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error/end-callback triggered for streams on ERR_NETWORK_CHANGED #1363

Open
maja42 opened this issue Sep 19, 2023 · 1 comment
Open

No error/end-callback triggered for streams on ERR_NETWORK_CHANGED #1363

maja42 opened this issue Sep 19, 2023 · 1 comment

Comments

@maja42
Copy link

maja42 commented Sep 19, 2023

We are using long-running server-streams where the server pushes updates to the frontend.
If the user's network connections change (e.g. due to entering / leaving a VPN), these long-running streams immediately stop - so far so good.

The Browser shows these streams as "failed" inside the network tab:
image

In addition to that, the console tab also shows the failed request:
image

Note though that the HTTP Status is 200.

The issue:
grpc-web does not propagate the error to our application. I'd expect both the "error" and "end"-callbacks to be triggered. Maybe even the "status"-callback.
(Or, at least, the "end"-callback). They are not.
As a consequence, these background-streams silently stop, and we can't inform the user or restart the streams.

Simplified code example:

this._alertServiceClient = new AlertServicePublicClient(/*...*/);

// ...

const req: Empty = new Empty();
this._alertStream = this._alertServiceClient.streamAlertChanges(req);

// None of these callbacks gets called if the stream stops with ERR_NETWORK_CHANGED:
this._alertStream.on('data', (response: AlertChanges) => {
  console.log('DATA', status); 
});
this._alertStream.on('error', (err: RpcError) => {
  console.log('ERROR', err); 
});
this._alertStream.on('end', () => {
  console.log('END'); 
});
this._alertStream.on('status', (status) => {
  console.log('STATUS', status); 
});

this._store.dispatch(AlertChangesStarted());

Setup:
We are using Google Chrome, but it also happens for other browsers.
The backend starts with an nginX-server, that forwards all grpc-web calls to an enovy proxy. Envoy then translates to grpc and forwards to individual backend services.

@sampajano
Copy link
Collaborator

sampajano commented Oct 13, 2023

@maja42 Thanks for the detailed report!

To help rule out any nginx issue, do you mind checking if you could reproduce the exact problem using our echo demo in docker?

https://github.com/grpc/grpc-web#advanced-demo-browser-echo-app

If you're able to reproduce there, it would be easier for us to debug and create a fix for you!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants