laravel-debugbar
laravel-debugbar copied to clipboard
Uncaught (in promise) DOMException: The user aborted a request.
First let me say thank you for this package and that I find it immensely helpful.
I just wanted to report this behavior for anyone who finds themselves distracted by it for two hours like myself.
When using AbortController() to cancel fetch requests, I kept seeing Uncaught (in promise) DOMException: The user aborted a request. in the console despite the fact that I was explicitly catching the error in my function. It was driving me crazy. I finally traced back through the log and found that the unhandled exception originates in debugbar in this code:
bindToFetch: function() {
var self = this;
var proxied = window.fetch;
if (proxied !== undefined && proxied.polyfill !== undefined) {
return;
}
window.fetch = function () {
var promise = proxied.apply(this, arguments);
promise.then(function (response) {
self.handle(response);
});
return promise;
};
},
Specifically here:
promise.then(function (response) {
self.handle(response);
});
This isn't really a big deal since it doesn't inhibit debugbar from doing its job when tracking AJAX requests. Again, just wanted to report this in case some future frustrated person is trying to figure out why they're seeing the console error.
Thanks for the excellent package!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
This problem is still there. When paired with React - it becomes a real problem. AbortController for fetch() is a common use case and it should be handled correctly.
@swayok hi, feel free to make a PR fixing that
@parallels999 Done: https://github.com/maximebf/php-debugbar/pull/585