keen / keen-tracking.js

A light, fast and flexible javascript tracking library
https://keen.io
MIT License
260 stars 85 forks source link

Client-side CORB Warning #174

Open vliegenthart opened 5 years ago

vliegenthart commented 5 years ago

We use this keen-tracking package to stream events directly from client-side browsers. Since recently this warning has been showing up:

Cross-Origin Read Blocking (CORB) blocked cross-origin response <KEEN API URL> with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

Anything we can do from our side to fix and/or circumvent it?

Thanks!

adamkasprowicz commented 5 years ago

Hi @vliegenthart Which version of the keen-tracking do you use? In v4 you can set a request type https://github.com/keen/keen-tracking.js#request-types By default it's Fetch, with a "cors" option turned on.

vliegenthart commented 5 years ago

Hi @adamkasprowicz,

My apologies for my slow response.

I'm using keen-tracking version 4.0.7 and I've enabled the beaconAPI request type. Is there a way to fix the mentioned error for beaconAPI? Thanks!

adamkasprowicz commented 5 years ago

Hi @vliegenthart , I passed this ticket to our backend guys. It's related to a mismatch between request headers and response headers. We can't control the headers of the beacon request, so we have to change the response headers for this kind of requests.

adamkasprowicz commented 5 years ago

PS: In the near future, we'll move from Beacon API to Fetch with KeepAlive flag. It's not yet supported because of cors bug https://bugs.chromium.org/p/chromium/issues/detail?id=835821

vliegenthart commented 5 years ago

Hi @adamkasprowicz,

Thanks for the update! I'll keep an eye out for any developments.

DroidUnknown commented 5 years ago

Is there any update on this issue? I am also facing CORB with latest keen tracking api. All my requests are getting blocked from Chrome browser with Beacon API.

If I try to use fetch api then some of the events are registered with status 200 or 201 but the events that are fired at page close get cancelled out.

vliegenthart commented 4 years ago

@adamkasprowicz Do you have any update on this issue? Thanks!

maciejrybaniec commented 4 years ago

Hi @DroidUnknown, Could You please specify if the request or responses are blocked ? Based on specification CORB prevents the browser from delivering cross-origin network responses. So all of events should be delivered correctly to Keen platform.

maciejrybaniec commented 4 years ago

Hi @vliegenthart

Actually the fixing for this issue is currently not on our roadmap due to other initiatives - especially having in mind that the discussion about beaconAPI is still open for different browsers (Mozilla) and it could change in near future.

The error about CORB should not affect the page that using Keen-Tracking and all events should be sent to correctly.

We'll try to address that issue as soon as it will be possible - by adding support to keepAlive flag - however the issue mentioned earlier (Bug) must be resolved to deliver a full working solution.