It seems that with the release of 3.20.0, the new Error cause support is overwriting the global Error object with one from this module. This is in order to support the new options argument to the constructor for cause support. The downside is there are a few "magical" properties on the Error object that provide some stack trace APIs like Error.stackTraceLimit and Error.prepareStackTrace. There are modules like https://www.npmjs.com/package/stack-trace and it's 737 dependents that end up with unexpected behavior when the case is being polyfilled.
That basically proxies the two properties back to the original Error object which v8 then is able to read when it performs the stack trace generation logic.
I'm not sure that is the full fix (like Object.defineProperties should probably use the impl that is in this module, it needs tests probably, etc.), but I just wanted to open this issue at least for now as I recently sustained a bad injury that makes typing quite painful at the moment. Perhaps someone will be gracious enough to develop a fix while I rest and heal.
Thanks for reading.
The text was updated successfully, but these errors were encountered:
we had some errors on our sentry(timeouts, etc.) but after upgrading to core-js@3.23 (from core-js2) we're getting the same errors wrapped in apply(core-js/internals/wrap-error-constructor-with-cause).
I thought this issue is similar to ours, so I wanted to ask it here.
thanks in advance. @zloirock
@itshadee make sure that all used copies of core-js are modern - a workaround for this was added in 3.22.0. If it will not help - please, add a reproducible example.
Hello👋
It seems that with the release of 3.20.0, the new Error cause support is overwriting the global
Error
object with one from this module. This is in order to support the newoptions
argument to the constructor for cause support. The downside is there are a few "magical" properties on theError
object that provide some stack trace APIs likeError.stackTraceLimit
andError.prepareStackTrace
. There are modules like https://www.npmjs.com/package/stack-trace and it's 737 dependents that end up with unexpected behavior when the case is being polyfilled.I started to take a look around, and a quick and dirt change that worked was adding something like the following in https://github.com/zloirock/core-js/blob/de16b4013b8de5b713437027cee6ec4d70831ccc/packages/core-js/internals/wrap-error-constructor-with-cause.js :
That basically proxies the two properties back to the original
Error
object which v8 then is able to read when it performs the stack trace generation logic.I'm not sure that is the full fix (like
Object.defineProperties
should probably use the impl that is in this module, it needs tests probably, etc.), but I just wanted to open this issue at least for now as I recently sustained a bad injury that makes typing quite painful at the moment. Perhaps someone will be gracious enough to develop a fix while I rest and heal.Thanks for reading.
The text was updated successfully, but these errors were encountered: