-
Notifications
You must be signed in to change notification settings - Fork 510
Open
Description
Ref: Open Next issue
Next 16.1 has the following code:
let nodeTimersPromises=require("node:timers/promises");
nodeTimersPromises.setImmediate=patchedSetImmediatePromise;It crashes workerd with:
[wrangler:error] TypeError: Cannot assign to read only property 'setImmediate' of object '[object Module]'
at install (file:///Users/vberchet/code/work/opennextjs-cloudflare/examples/e2e/app-router/.open-next/server-functions/default/examples/e2e/app-router/handler.mjs:8:21434)
However both the snippets work with Node:
// cjs
nodeTimersPromises=require("node:timers/promises");
nodeTimersPromises.setImmediate=()=>console.log('test');
nodeTimersPromises.setImmediate()
// esm
import ntp from 'node:timers/promises';
ntp.setImmediate = ()=>console.log('test');
ntp.setImmediate();I have tried to use the following compat flags but if didn't help:
disable_fast_jsg_structmutable_api_prototypes
I wasn't able to test with enable_nodejs_global_timers but we should make sure the fix works whether or not this flag is set.
TonySeedy, mathew2103 and paigely
Metadata
Metadata
Assignees
Labels
No labels