🐛 BUG: Importing getPlatformProxy
hijacks certain process.on
events
#6935
Labels
getPlatformProxy
hijacks certain process.on
events
#6935
Which Cloudflare product(s) does this pertain to?
Wrangler
What version(s) of the tool(s) are you using?
3.80.2 [Wrangler]
What version of Node are you using?
22.9.0
What operating system and version are you using?
Mac Sequoia 15.0.1
Describe the Bug
Observed behavior
Simply importing
getPlatformProxy
from wrangler automatically addsprocess.on('uncaughtException', ...)
andprocess.on('unhandledRejection', ...)
listeners that re-throw . This prevents user code from handling those errors.Expected behavior
Being able to listen to and handle these errors despite using
getPlatformProxy
Explanation
Importing runtime APIs like
getPlatformProxy
leads to importing the code of the cli and some of that code runs on import.From what I can tell the listeners that hijack these events stem from the
yoga-layout
package used withinink
. The dependency is precompiled and zipped and lives inside thevendor/
directory in this repo.The specific handlers added (wish I could point directly to the source here but it being precompiled and zipped makes that not possible):
Re-throwing here makes all listeners added after not trigger.
Steps to reproduce
Small repro also provided below, but simply given this code:
One expects to see the error handler called. This is not the case.
Please provide a link to a minimal reproduction
https://github.com/rognstadragnar/cloudflare-wrangler-bug-repro
Please provide any relevant error logs
No response
The text was updated successfully, but these errors were encountered: