You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, while preloading the bundle code for the benefit of debuggers, the execution context isn't configured properly, so that globalThis.__webpack_module_cache__ is undefined. That causes a type error while running the bundled code, which should presumably get caught by the try-catch block in worker.ts. However, the abort-on-uncaught-exception operates at V8's level (rather than Node's event loop level) and V8's is not aware of the cross-execution-context call involved by script.runInContext(), so it can't figure out that the error happening in the child context will get properly handled by the parent context, resulting in aborting execution.
Some quick fixes are possible, e.g. adding a ?? {} suffix to the problematic line in bundler, but I'm afraid the problem may reappear at a later time as other global variables get added; we should therefore consider moving the preload to the VM.
More over, this preload somewhat expensive and only pertinent if there's an attached inspector, which is rarely the case. We should therefore make it conditional to the presence of a debugger.
The text was updated successfully, but these errors were encountered:
Describe the bug
Starting a Worker with Node option
--abort-on-uncaught-exception
results in the following error message:How to reproduce
Start the Hello World sample's Worker with:
Details
The stack trace points out to the following code locations:
https://github.com/mjameswh/sdk-typescript/blob/4dcc82aa48fc285119978bd2a93acc3a0e9fd231/packages/worker/src/worker.ts#L1791-L1798
https://github.com/mjameswh/sdk-typescript/blob/4dcc82aa48fc285119978bd2a93acc3a0e9fd231/packages/worker/src/workflow/bundler.ts#L117
That is, while preloading the bundle code for the benefit of debuggers, the execution context isn't configured properly, so that
globalThis.__webpack_module_cache__
is undefined. That causes a type error while running the bundled code, which should presumably get caught by the try-catch block in worker.ts. However, theabort-on-uncaught-exception
operates at V8's level (rather than Node's event loop level) and V8's is not aware of the cross-execution-context call involved byscript.runInContext()
, so it can't figure out that the error happening in the child context will get properly handled by the parent context, resulting in aborting execution.Some quick fixes are possible, e.g. adding a
?? {}
suffix to the problematic line in bundler, but I'm afraid the problem may reappear at a later time as other global variables get added; we should therefore consider moving the preload to the VM.More over, this preload somewhat expensive and only pertinent if there's an attached inspector, which is rarely the case. We should therefore make it conditional to the presence of a debugger.
The text was updated successfully, but these errors were encountered: