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
I'm trying to connect to Binance Mainnet inside a Cloudflare Worker and need the skipFetchSetup: true flag (introduced in #1886), but it is only available for JsonRpcProvider and not BscscanProvider.
Without the flag, fetch doesn't work inside Cloudflare. I have simulated a request using BscscanProvider by hardcoding the skipFetchSetup flag and it works.
The standard Binance Mainnet endpoint is not working (getting HTTP 403 errors) with JsonRpcProvider. I suspect Binance is throttling requests from Cloudflare Worker IPs. Binance Testnet does work with JsonRpcProvider however.
I suppose EtherscanProvider would also benefit from the same flag.
Code Snippet
let p = new BscscanProvider(56, "<your BscScan api key>");
await p.getBalance(addr); //errors
Contract ABI
No response
Errors
No response
Environment
Other (please specify)
Environment (Other)
Cloudflare Worker
The text was updated successfully, but these errors were encountered:
I've worked around this by patching post build. This is kinda sketch and breaks if you turn on minification. You could also use patch-package but seems like there's like 20 prebuilt modules in the node_modules for ethers
sed -i '' 's/options.skipFetchSetup !== true/false/g' dist/worker.js
Having this issue with ethers 6.3, but now with "Script startup exceeded CPU time limit". Skipping provider setup and falling back to regular fetch() causes everything to work.
Ethers Version
5.6.8
Search Terms
cloudflare
Describe the Problem
I'm trying to connect to Binance Mainnet inside a Cloudflare Worker and need the
skipFetchSetup: true
flag (introduced in #1886), but it is only available forJsonRpcProvider
and notBscscanProvider
.Without the flag,
fetch
doesn't work inside Cloudflare. I have simulated a request usingBscscanProvider
by hardcoding theskipFetchSetup
flag and it works.The standard Binance Mainnet endpoint is not working (getting HTTP 403 errors) with
JsonRpcProvider
. I suspect Binance is throttling requests from Cloudflare Worker IPs. Binance Testnet does work with JsonRpcProvider however.I suppose
EtherscanProvider
would also benefit from the same flag.Code Snippet
Contract ABI
No response
Errors
No response
Environment
Other (please specify)
Environment (Other)
Cloudflare Worker
The text was updated successfully, but these errors were encountered: