Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug TypeScript NS_BINDING_ABORTED for POST-Requests

I got a simple functionality that calls my backend, via POST-Request. It uses the same wrapper function that is used everywhere in the project, just does "fetch" and is called in some async/await-manner.

body is just static stuff, some ID and two dates. pretty straightforward - the wrapper-function would fail if body weren't supplied at all or similar.

but the request "always" (well, there were one or two successfull tries in about 100 retries) fails with NS_BINDING_ABORTED

some debugger info about the requsts

Google tells me that message means I had some cache hit and the request was canceled - but cache is disabled, Header-Vars should prevent it AND adding random stuff to the URL doesn't do shit. (sometimes that OPTIONS-call gets through, but POST itself fails still)

nearly all post-requests in that project are done with this exact same wrapper.

Anyone got some ideas where I could look to debug this?

like image 226
Dr. Azrael Tod Avatar asked Apr 19 '26 08:04

Dr. Azrael Tod


1 Answers

Turns out my request wasn't cancelled due to a cache hit, but due to page reload.

The reload was caused by a form that was submitted after my onclick-event fired, but before my request had any chance to be completed.

Note: Always set that type-property on your buttons

Still no idea how to debug that in general, but in my case having the browser clearing it's network-tab and the reason for the next request beeing due to Initiator: document should have been a clue, meaning it's not done by some JS, but by some html functionality.

Further Reading:

  • NS_BINDING_ABORTED Javascript window.location.replace()
  • MDN Archive - Network Error Codes
like image 116
Dr. Azrael Tod Avatar answered Apr 20 '26 20:04

Dr. Azrael Tod