Skip to content

Unable to retry loadRemote after failed attempt #3685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
nameofname opened this issue Apr 10, 2025 · 1 comment
Open
5 tasks done

Unable to retry loadRemote after failed attempt #3685

nameofname opened this issue Apr 10, 2025 · 1 comment

Comments

@nameofname
Copy link
Contributor

Describe the bug

We have been experiencing temporary outages which only occur on prod after starting a new container, or MFE revalidation where loadRemote is unable to fetch a remote MFE, even though the remote is published and no changes since the last deploy. The root cause of the loadRemote failures is a separate topic - this issue deals with the fact that our retry logic is currently unable to mitigate the issue - instead once loadRemote fails, it will continue to fail no matter how many times you call it.

I have created a sample repository to demo the bug here :
https://github.com/nameofname/next-module-federation/tree/master/fix-chunk-retries

IMPORTANT DISCLAIMER: Our setup uses nextjs-mf plugin and we rely on SSR for our MFEs. We're aware that it's deprecated. This is particularly relevant to this bug because the server side MFE imports (loadRemote) will fail until the node process is restarted.

After investigating, I found that the same promise is returned from loadRemote, and after diving into the code identified the handle function in @module-federation/node's runtimePlugin. I am opening a PR to address, however I'm not sure the full implications of the change, and want to discuss if it's appropriate or a different solution would work.

*Note - I also tried out using the retry plugin available from the core package and had the same issue.

Reproduction

https://github.com/nameofname/next-module-federation/tree/master/fix-chunk-retries

Used Package Manager

npm

System Info

System:
    OS: macOS 15.3.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 263.16 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.local/share/mise/installs/node/20/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.5.0 - ~/.local/share/mise/installs/node/20/bin/npm
    pnpm: 10.8.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 135.0.7049.43
    Safari: 18.3.1

Validations

@nameofname
Copy link
Contributor Author

I have created one more PR related to this issue :
#3729
... this one will tell you which file failed to load. In addition I created some unit tests for my first change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant