Closed Bug 1826110 Opened 2 years ago Closed 1 year ago

error object for failed loading of dynamically imported module is incomplete

Categories

(Core :: JavaScript Engine, enhancement, P3)

Firefox 112
enhancement

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: daajay1, Assigned: allstars.chh)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Steps to reproduce:

Hi I'm front-end developer and I'm working on react.js based app - we've implemented lazy-loading with retries functionality based on this article and I've found out that there's different behaviour on firefox when it is compared to working properly Chrome.
https://medium.com/@alonmiz1234/retry-dynamic-imports-with-react-lazy-c7755a7d557a

Actual results:

Basically how the lazyWithRetries functionality works - if we fail to load dynamic lazy module - for loop starts - it takes error.message property and extracts URL of the module, in chrome this error looks like this:

{
"stack": "TypeError: Failed to fetch dynamically imported module: http://localhost:3000/assets/LazyComponent-03ed4069.js",
"message": "Failed to fetch dynamically imported module: http://localhost:3000/assets/LazyComponent-03ed4069.js"
}

Then after URL is created, we're adding timestamp to search params - just to deal with browser caching unloaded properly module.

Unfortunately for firefox here's how error looks like:

{
"fileName": "",
"lineNumber": 0,
"columnNumber": 0,
"message": "error loading dynamically imported module"
}

So creating the URL from message property is impossible.

Expected results:

I'd like firefox to return either URL of file that failed in error message or return file in fileName property, it would be much more readable error response and something can be done with it. For now it is impossible to retry with another request when lazy module is loaded so experience of users in web-apps can be worse than in chrome.

I will set this enhancement as new so the engineering team could decide if they take in consideration changing this.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Sure, thanks!

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Networking' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Networking
Product: Firefox → Core
Component: DOM: Networking → JavaScript Engine

Jon, would you have any idea who would be the person to look at this issue?

Blocks: sm-runtime
Severity: -- → N/A
Flags: needinfo?(jcoppeard)
Priority: -- → P3

I agree it would be nice if the error message included the URL.

Maybe Yoshi could take a look at this?

Flags: needinfo?(jcoppeard) → needinfo?(allstars.chh)
Assignee: nobody → allstars.chh
Flags: needinfo?(allstars.chh)
Pushed by allstars.chh@gmail.com: https://hg.mozilla.org/integration/autoland/rev/2b230514f3b9 Add the module's URL into the error message. r=jonco
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: