Skip to content

[bug] Unhandled Promise Rejection on getSupportedNetworks #3896

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
xyzseer opened this issue Feb 21, 2025 · 8 comments
Open

[bug] Unhandled Promise Rejection on getSupportedNetworks #3896

xyzseer opened this issue Feb 21, 2025 · 8 comments
Labels
bug Something isn't working needs review

Comments

@xyzseer
Copy link

xyzseer commented Feb 21, 2025

Link to minimal reproducible example

N / A

Summary

Hi, we have a vite app with SSR enabled, and we are seeing this error on the logs

Feb 21, 07:11:58 AM: 721e05e3 ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: fetch failed","reason":{"errorType":"TypeError","errorMessage":"fetch failed","stack":["TypeError: fetch failed"," at node:internal/deps/undici/undici:13185:13"," at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"," at async fetchData (file:///var/task/node_modules/@reown/appkit-core/dist/esm/src/utils/FetchUtil.js:2:22)"," at async Proxy.get (file:///var/task/node_modules/@reown/appkit-core/dist/esm/src/utils/FetchUtil.js:20:26)"," at async Object.getSupportedNetworks (file:///var/task/node_modules/@reown/appkit-core/dist/esm/src/controllers/BlockchainApiController.js:110:33)"," at async AppKit.initializeBlockchainApiController (file:///var/task/web/node_modules/@reown/appkit/dist/esm/src/client.js:507:9)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: fetch failed"," at process.<anonymous> (file:///var/runtime/index.mjs:1276:17)"," at process.emit (node:events:519:28)"," at emitUnhandledRejection (node:internal/process/promises:250:13)"," at throwUnhandledRejectionsMode (node:internal/process/promises:385:19)"," at processPromiseRejections (node:internal/process/promises:470:17)"," at process.processTicksAndRejections (node:internal/process/task_queues:96:32)"]}

I think the request made by getSupportedNetworks fails and as it happens on the server it completely kills the webpage

Is there any way to fix it? I saw a PR that deferred the call (#3810), maybe something like that should work?

Thanks!

List of related npm package versions

"@reown/appkit": "^1.6.8",
"@reown/appkit-adapter-wagmi": "^1.6.8",
"viem": "2.17.5",
"vike": "^0.4.223",
"wagmi": "2.14.6",

Node.js Version

20.18.0

Package Manager

yarn

@xyzseer xyzseer added bug Something isn't working needs review labels Feb 21, 2025
Copy link

linear bot commented Feb 21, 2025

@danielrea
Copy link

Hello, is there any update on a fix for this or a way of avoiding it in the meantime?

@xyzseer
Copy link
Author

xyzseer commented Mar 7, 2025

we had to go back to web3modal :/ until this issue is fixed appkit is unusable with SSR

@rbuddy101
Copy link

rbuddy101 commented Mar 8, 2025

Looks like a fix was pushed but im still getting this on 1.6.9 (newest version)

Unhandled Rejection: TypeError: fetch failed
at async i (.next/server/chunks/1114.js:5695:10752)
at async Proxy.get (.next/server/chunks/1114.js:5695:11011)
at async Object.getSupportedNetworks (.next/server/chunks/1114.js:5700:112156)
at async x.initializeBlockchainApiController (.next/server/chunks/1114.js:12139:26855) {
[cause]: [Error: write ETIMEDOUT] {
errno: -110,
code: 'ETIMEDOUT',
syscall: 'write'
}
}
Node.js process exited with exit status: 128. The logs above can help with debugging the issue.

@arein
Copy link
Contributor

arein commented Mar 12, 2025

@xyzseer we will shortly be working on SSR improvements
CC @Sam-Newman

@Sam-Newman Sam-Newman removed the bug Something isn't working label Mar 13, 2025
@Sam-Newman Sam-Newman added the bug Something isn't working label Mar 17, 2025 — with Linear
@arein
Copy link
Contributor

arein commented Mar 24, 2025

@xyzseer @rbuddy101 @danielrea can we please get a reproducible example? I'm unsure if this is blocked by #3896 or not - a reproducible example would help us be able to fix

@arein arein closed this as completed Mar 24, 2025
@arein arein reopened this Mar 24, 2025
@satyam-mishra-pce
Copy link

@arein
I think that this should be fixed. Its completely ripping off the SSR page, and we get Internal Server Errors.
I had it in NextJS App deployed on Vercel in production, and it broke it.

Image

@satyam-mishra-pce
Copy link

This error doesnt not happen all the time, because the fetch doesnt fail so often ig.
I sometimes see it when trying to visit the deployed page, and it just shows internal server error (caused by this), and then it keeps working fine after refresh.

Average Frequency: 2-3 times a week.
The issue is same as #3810 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs review
Projects
None yet
Development

No branches or pull requests

6 participants