-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Unhandled rejection when using rewrite proxy #72522
Comments
I tried a fix here : #72530 |
wyattjoh
added a commit
that referenced
this issue
Nov 28, 2024
Trying to fix : #72522 ### What? The finally method actually creates a new promise. You have to listen to this new promise instead of the original one or you might end up with unhandled rejection. Taken from the documentation : > The finally() method of [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) instances schedules a function to be called when the promise is settled (either fulfilled or rejected). It immediately returns another [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object, allowing you to [chain](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining) calls to other promise methods. ### Why? see : #72522 ### How? Fixes : #72522 Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Link to the code that reproduces this issue
https://github.com/JeremieDoctrine/next-proxy-issue
To Reproduce
You can see in the logs
Current vs. Expected behavior
Currently the proxy is throwing an
unhandledRejection
.The expected behavior is not to throw an
unhandledRejection
.Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:38:45 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T8122 Available memory (MB): 16384 Available CPU cores: 8 Binaries: Node: 21.7.3 npm: 10.5.0 Yarn: 1.22.22 pnpm: 9.12.3 Relevant Packages: next: 15.0.4-canary.2 // Latest available version is detected (15.0.4-canary.2). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.6.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), Other (Deployed)
Additional context
The issue was introduced in this PR : #65759 from @wyattjoh
Commenting this line :
next.js/packages/next/src/server/lib/router-utils/proxy-request.ts
Line 89 in 55552ba
The text was updated successfully, but these errors were encountered: