You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sendOnClose method to flush logs before the user closes/tabs away from the client app does not utilize any header information, nor can it.
/**
* Attempts to flush the remaining logs when the window is closed.
* @param {Array} logs Array of logs to be flushed.
* @param {Object} config Configuration object to be read from.
*/
export function sendOnClose(logs, config) {
window.addEventListener("pagehide", function () {
if (config.on && logs.length > 0) {
navigator.sendBeacon(config.url, JSON.stringify(logs));
logs.splice(0); // clear log queue
}
});
}
Cause
navigator.sendBeacon does not support auth headers, so this will fail if auth is required.
Problem
The
sendOnClose
method to flush logs before the user closes/tabs away from the client app does not utilize any header information, nor can it.Cause
navigator.sendBeacon
does not support auth headers, so this will fail if auth is required.Solution
The alternative is to use
fetch()
withkeepalive: true
as per official docs and SO suggestions.The text was updated successfully, but these errors were encountered: