Axe-core: TypeError: Failed to construct 'URL': Invalid URL

Created on 2 Mar 2021  路  8Comments  路  Source: dequelabs/axe-core


This is for the chrome extension "axe - Web Accessibility Testing" which I believe is also developed by dequelabs. I was unsure where else to post this error.

Expectation: Not console error

Actual:

Uncaught (in promise) TypeError: Failed to construct 'URL': Invalid URL
    at y (content.bundle.js:33)

Motivation: So I can read more important console errors relating to development


axe - Web Accessibility Testing version: 4.8.4

Browser and Assistive Technology versions
Browser: Chrome 88.0.4324.190 (Official Build) (64-bit)
Operating System: Windows 10

This occurs on any page, even Google. The error usually occurs
image
image

multiple times.

Thanks.

extension

Most helpful comment

Close, but not quite!

We were trying to construct an instance of a URL for communicating with the axe API server (https://axe.deque.com) before the server's URL is set. We keep the server's URL in the extension's storage. The code looked something like this:

var stored_url = await get_from_browser_storage('axe_server_url')
var url = new URL(stored_url)

The fix resembles:

var stored_url = await get_from_browser_storage('axe_server_url')
var url = new URL(stored_url || DEFAULT_SERVER_URL)

All 8 comments

I think I have the solution for this. The URL I think it is having issues with is: https://axe.deque.com which appears in the file a couple if times. If you go to this URL you actually get redirected to https://auth.deque.com/auth/realms/axe/protocol/openid-connect/auth?client_id=axepro-public&redirect_uri=https%3A%2F%2Faxe.deque.com%2F&state=cfeec79f-fbbd-4bbc-8ec3-7ea9b3ea8032&nonce=eab19a6a-0984-4ec3-8143-a4c0f9b43078&response_mode=fragment&response_type=code&scope=openid So I think this URL needs updating

Thanks for reporting!

We've identified the problem and have fixed the issue. The next release of the extension (date TBD) will prevent this from happening.

Was the fix what I thought it was?

Close, but not quite!

We were trying to construct an instance of a URL for communicating with the axe API server (https://axe.deque.com) before the server's URL is set. We keep the server's URL in the extension's storage. The code looked something like this:

var stored_url = await get_from_browser_storage('axe_server_url')
var url = new URL(stored_url)

The fix resembles:

var stored_url = await get_from_browser_storage('axe_server_url')
var url = new URL(stored_url || DEFAULT_SERVER_URL)

Just spoke with @erik-deque. We'll get a release out the door soon(-ish) for you all 馃槃

Thanks for letting me know the fix :D and super thanks for looking into fixing it so quickly <3

Quick fix! Thanks 馃憤

Closing as this was fixed in the 4.8.6 release of the extension.

Was this page helpful?
0 / 5 - 0 ratings