Ns error interception failed

RESOLVED (nobody) in Core - DOM: Service Workers. Last updated 2022-07-19.


Closed

Bug 1710921


Opened 2 years ago
Closed 7 months ago

We’ve received a webcompat issue about the search form at https://www.medicare.gov/medical-equipment-suppliers/?redirect=true not working correctly if the zip code 32162 is used (and probably all others, but I’m copying that just in case)

On inspection, the «invalid zip» error is just a general fallback message for whenever the request to the search endpoint fails. In the devtools, I can see the request to https://www.medicare.gov/api/procedure-price-lookup/dme/api/v1/address/lookup?zipcode=32162 failing with NS_ERROR_INTERCEPTION_FAILED

Unfortunately, I don’t see the service worker in question in about:debugging, and I see no additional errors in the browser toolbox either, so I’d appreciate some help here.

Flags: needinfo?(bugmail)

Webcompat Priority: P2 → ?

I tried this in current Nightly and now I get:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://bam.nr-data.net/resources/1/642335d5b5?a=145488977&sa=1&v=1123.df1c7f8&t=Unnamed%20Transaction&rst=16274&ref=https://www.medicare.gov/medical-equipment-suppliers/&st=1637918714895&ptid=64352472-0001-be2b-8047-017d5b90455b. (Reason: CORS request did not succeed). Status code: (null).

Karl, that looks more like a real site error and we are just stricter than other browsers?

Flags: needinfo?(bugmail) → needinfo?(kdubost)

Severity: — → S4

Priority: — → P3

I also get one, but different.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://pc-cmsgov-collect.tealiumiq.com/cmsgov/medicare-www/2/i.gif. (Reason: CORS request did not succeed). Status code: (null).

  1. in about:config, if I set content.cors.disable: true this is working.
  2. I still get error messages about CORS in the console.
  3. I get a new error message Uncaught SyntaxError: missing ] after element list utag.sync.js:9:8note: [ opened at line 9, column 0utag.sync.js:9
  4. resetting the cors setting to false
  5. Trying again. https://www.medicare.gov/medical-equipment-suppliers/results?location=32162 (WORKING)
  6. Going to https://www.medicare.gov/medical-equipment-suppliers/?redirect=true
  7. new error messages such as Error: no slsRequestToken, see fetchUser thunk main.c7b6953b.chunk.js:1:20419 which seems generated because one of the request is considered unauthenticated. But this happens on Edge and Safari too.
  8. Still Entering the postcode and having the right results.

So I guess CORS forbade the setting of something (cookie, caching of a piece of code, etc?) than then the site was not able to work. Once the parameter has been set the site is «working» even with CORS activated.

On Edge Blink. I get this too.

(index):1 
        
       A parser-blocking, cross site (i.e. different eTLD+1) script, https://tags.tiqcdn.com/utag/cmsgov/medicare-www/prod/utag.sync.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.

On Safari, yet another strange message.

AES-CBC and AES-CTR do not provide authentication by default, and implementing it manually can result in minor, but serious mistakes. We recommended using authenticated encryption like AES-GCM to protect against chosen-ciphertext attacks.
quantum-medicare.js:57:296

but everything is working.

so it is messy, but indeed like Dennis I’m not sure what is the source.

AH! After trying a couple of times it worked. (reload and/or shift+reload) Do you have the same thing (on desktop)

Flags: needinfo?(kdubost) → needinfo?(dschubert)

Note that shift-reload bypasses ServiceWorker interception. (Although also note that the ServiceWorker at https://www.medicare.gov/medical-equipment-suppliers/service-worker.js uses clients claim, so it will try and take over existing pages whenever it can… but when bypasses I guess it won’t try and do that.)

Also, it seems like the default ETP tracking protection behavior for me on Nightly thinks the https://bam.nr-data.net/ URL is a tracker. If I turn that off things seem to work fine?

Flags: needinfo?(dschubert) → needinfo?(twisniewski)

ni? myself to check if this is still an issue.

Flags: needinfo?(twisniewski) → needinfo?(dschubert)

Flags: needinfo?(dschubert) → needinfo?(wisniewskit)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:jstutte, since the bug has recent activity, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(wisniewskit) → needinfo?(jstutte)

I assume this was meant to go to you, Thomas?

Flags: needinfo?(jstutte) → needinfo?(twisniewski)

I seem to be able to enter a zip code just fine now on the site, maybe it has been fixed? Dennis, does it also work for you?

Flags: needinfo?(twisniewski) → needinfo?(dschubert)

I can’t.

Status: NEW → RESOLVED

Closed: 7 months ago

Webcompat Priority: ? → —

Flags: needinfo?(dschubert)

Resolution: — → WORKSFORME

Hi. @mylesdawson. Thanks for reporting this.

I’ve followed the steps above and was able to reproduce this in Firefox. It appears you are making a GraphQL request. Since it’s not handled with MSW, you expect it to hit an actual endpoint and be performed as-is.

In the example project I’m trying this, my GraphQL endpoint and the address of my app differ.

  • App runs at http://localhost:3002
  • GraphQL endpoint is http://localhost:3000

When I follow those steps I also see a few console errors in the «Console» tab of the DevTools:

[MSW] Failed to mock a "POST" request to "http://localhost:3000/graphql": TypeError: NetworkError when attempting to fetch resource.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/graphql. (Reason: CORS request did not succeed).

Failed to load ‘http://localhost:3000/graphql’. A ServiceWorker passed a promise to FetchEvent.respondWith() that resolved with non-Response value ‘undefined’.

Response mode seems to have no effect on this issue: it’s reproducible either way (FireFox 84.0.2 (64-bit), 85.0.2 (64-bit)).

I also see the NS_ERROR_INTERCEPTION_FAILED state of the request in the «Transferred» column of the «Network» tab, just as you’ve described.

Why is this happening?

I suspect you have a similar setup to mine: your app’s address and your GraphQL address differ. When you attempt to perform a bypassed (not mocked) request to your actual GraphQL endpoint, you get a CORS violation.

Can you please check the console errors and report if there are any?

How to fix this?

Here are some guidelines on how to avoid CORS errors on localhost.

If CORS is the reason, the error isn’t specific to the library: you cannot request external resources from localhost, CORS won’t allow that. You’d have to set up your app to enable such requests while you’re developing locally. Above I’ve linked but one example of how to do that, you can also find other online.

In the case it’s not it

MSW will not intercept the request, the server will respond with the correct status and data

Note that MSW intercepts all requests in the worker, sends them to the client where it decides whether to mock a request or not. This is intentional behavior, otherwise, we won’t be able to process all traffic, granting a predictable mocking. Yes, one of the surfaces that would error during a failed request will be the worker, but there’s usually more info to that (like the CORS errors indicating what is the real culprit).

In the case if what I described above isn’t applicable to your case, please provide us with the following information:

  • How do you make a request (exact client calls)?
  • What are the addresses of your app and your GraphQL endpoint you try to hit (the not mocked one)?
  • Can you provide a reproduction repository confirming the issue is not CORS?

This article is protected, probably because it was spammed repeatedly. To edit protected pages, bug me to try to make the spam protection better, or register and contact me.

These are primarily notes
It won’t be complete in any sense.
It exists to contain fragments of useful information.

Contents

  • 1 0x80004005 (NS ERROR FAILURE)
    • 1.1 nsIXMLHttpRequest.*
    • 1.2 Unsorted
  • 2 0x80040111 (NS ERROR NOT AVAILABLE)
    • 2.1 Reason
    • 2.2 Fix
    • 2.3 See also

0x80004005 (NS ERROR FAILURE)

…is a very general-purpose error (not even just in mozilla)

When scripting triggers it, then the error also usually points to a more specific problem.
To figure out what failed, look for the origination function.

For example, in:

[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
[nsIDOMHTMLSelectElement.selectedIndex]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" 
location: "JS frame ::

…it’s

nsIDOMHTMLSelectElement.selectedIndex

, a good thing to search for.

This particular error was caused by trying to set an out-of-bounds selectedIndex on a <SELECT> drop-down .

nsIXMLHttpRequest.*

XmlHTTPRequest-related errors will usually occur in either nsIXMLHttpRequest.open or nsIXMLHttpRequest.send

The specific error is often the best indication of the problem.

The actual problem to fix (often in the scripting logic) is regularly one of:

  • stale references, often between documents , or the browser got confused about when it should clean up. For example, if the document an XHR was created in does not exist anymore, or using an old reference to a new embedded plugin object (e.g. video)
  • that you violated the specs or did something nonsensical, e.g. trying to send() more than once(verify) or trying to set headers after sending data (verify)
  • Use of firebug:
    • If you are using firebug, you should be aware that there are older versions that did not handle XHR in frames well. Firebug would be the sole cause of the last mentioned error.
    • triggering XHR from the firebug command line is sandboxed, and may cause this in certain cases
  • trying cross-domain XHR, or using an absolute URL (verify)

You could even look at the Firefox XHR source code, e.f. for send(), to see what cases trigger this error.

TODO: Read:

  • http://www.fleegix.org/articles/2006/10/21/xmlhttprequest-and-0x80004005-ns_error_failure-error

Unsorted

0x80040111 (NS ERROR NOT AVAILABLE)

Reason

The direct reason is a missing object attribute — you are probably expecting an attribute to be present on an object when it is not always.

When this happens around an XMLHttpRequest, one of the likeliest causes around is an onerror handler that tries to read the result’s status (or statusText).

The W3 specs tell you that you shouldn’t try to read status in the onerror handler because for some problems it may not be set, and that accessing it must (!) then lead to an exception raise.

In other words, this error is then correct behaviour.

This error is more specific to Gecko (Firefox, Mozilla) because it adheres to those specs closer to the letter in this regard.
So for portable code you want to adhere to that always.

The underlying cause is often that the browser never got a response with a HTTP status to parse out, for example because:

  • a connection broke before receiving a response at all, e.g. because of some connectivity problem
  • a request was broken off on the client
  • an ongoing AJAX call is canceled by page unload
    • (another somewhat common form of this is when you trigger AJAX from an input form that also causes a page-reload-style submission of the calling page (often a form with a submit-type button))
  • or sometimes a (seriously) malformed server response, such as
    • deformed data made by a dynamic script
    • no data at all (no HTTP headers, no body)

Fix

If this happens in your own handler code, and you can’t or don’t want to remove the status check, the simplest workaround is usually to wrap this read in a try-catch, since the error handling would often be «oh well, forget it then» code anyway.

If you use XHR from some library (and implicitly its error handler), it’s a bug in that library that has not yet been fixed, so search around for a newer version, bother its creator, and/or fix it yourself.

If such a library it lets you write your own callbacks and its documentation didn’t warn you about this, you might wish to bother them about that — it’s nice to be able to have code that can react to this if and when it chooses to.

When caused by the form submission problem, you can usually avoid it.
One solution is to use only a <button>, <input type=»button»>, or anything else that looks clickable enough but does not submit the form (like a submit button would), so that the only event is the AJAXing.

See also

  • http://www.w3.org/TR/XMLHttpRequest/ (the «The XMLHttpRequest Object» section)
  • https://bugzilla.mozilla.org/show_bug.cgi?id=238559

mogen

mogen

@mogen

reverse engineer

Здравствуйте!

Никак не могу понять, в чём дело.
У меня установлен Arch linux. Установил VirtualBox и не могу запустить виртуальную машину. Ошибка
NS_ERROR_FAILURE. Скрин прикрепляю внизу.

5fa64de53b903804489565.png

На windows 10 virtualbox прекрасно работает. У меня на Arch Linux прекрасно работает KVM или Qemu. Пытался переустанавливать и запускать от root на arch linux. Искал информацию и способы решения ошибки в интернете об ошибке, но не помогло.

Прошу помощи у сообщества Хабра с решением моей проблемы.


  • Вопрос задан

    более двух лет назад

  • 5555 просмотров

во первых, непонятно зачем создавать(судя по значку) виртуальную машину как Debian а не как Arch (Тип: Linux, Версия: Arch Linux(64-bit))
во вторых, откуда вы загружаетесь ? по скрину видно что Оптический диск пустой, а жесткого диска вообще нету
в третьих, у арча есть замечательная вики, где есть статья VirtualBox где расписано как правильно его готовить, например использовать DKMS если используется нестандартное ядро, или там подгрузить все нужные модули как то vboxdrv (подгрузить вручную modprobe vboxdrv или просто перезагрузить комп если прописать в нужном месте), у меня например в файле /etc/modules-load.d/vbox.conf прописаны следующие модули:

vboxdrv
vboxnetadp
vboxnetflt

если это не помогает то там же в статье на арчвики есть пункт NS_ERROR_FAILURE and missing menu items в котором также говорится о подобной ошибке

Пригласить эксперта


  • Показать ещё
    Загружается…

10 февр. 2023, в 00:54

2000 руб./в час

10 февр. 2023, в 00:15

1000 руб./в час

09 февр. 2023, в 22:06

500 руб./за проект

Минуточку внимания

Понравилась статья? Поделить с друзьями:
  • Ns error failure 0x80004005 virtualbox mac os
  • Ns error failure 0x80004005 virtualbox fedora
  • Ns error failure 0x80004005 virtualbox astra linux
  • Ns error factory not registered 0x80040154
  • Ns error dom bad url