Azure / fetch-event-source

A better API for making Event Source requests, with all the features of fetch()
MIT License
1.76k stars 137 forks source link

"Event Stream" tab is empty in Chrome dev tools #3

Closed lttb closed 3 years ago

lttb commented 3 years ago

Hi! Thank you very much for your work.

I was wondering if you have ever faced with this issue: "Event Stream" tab is empty in Chrome dev tools:

image

It seems that this problem is related to these issues:

At the moment, it looks like that the events will be shown only if the native EventSource used, but if you could share any workarounds or ideas about it, that would be amazing. Thanks!

vishwam commented 3 years ago

Apologies for the late reply @lttb. Yes, unfortunately that's a known issue with this approach: chrome dev tools apparently only works with the native EventSource. What we've done in Azure is to put our own logging in the onmessage callback, for example:

fetchEventSource('/api/sse', {
    onmessage(msg) {
        if (process.env.NODE_ENV === 'development') {
            console.debug('[EventSource]', msg);
        }

This is definitely less convenient, but has been enough for us to debug issues the last couple years.

maltoze commented 1 year ago

there is a chrome extension to view EventStream in devtools. https://github.com/maltoze/sse-viewer

PvanHengel commented 1 year ago

Curious has anyone opened a bug/feature in the Chrome project for this?

huoyixin commented 1 year ago

Couldn't find a solution, so I logged all data in the console for easier debugging.

Here is my log code. group all data in a table in the console panel.

image

https://gist.github.com/huoyixin/82a8deb64aa6b380f89d6048a44dda11

piotr-cz commented 10 months ago

Looks like Chromium team has been actively working on the issue recently: https://bugs.chromium.org/p/chromium/issues/detail?id=1025893

piotr-cz commented 8 months ago

Comment on the Chromium Issue tracker:

The fix is already available in Chrome Canary starting with 123.0.6283.0. M123 will be beta on February 21st and stable on March 19th.