PoC repo to reproduce error
yarn
andnpm install wrangler
- in one terminal run
npx wrangler dev --local
- in the second terminal run
curl localhost:10005
My hypothesis of why this is happening
@ethersproject/providers (which I assume you use) had this type of behavior in my previous experience with CF workers.
I switched my functionality to latest (v6) ethers and it solved this issue for me.