Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please support skipFetchSetup for BscscanProvider and EtherscanProvider #3067

Closed
tyuen opened this issue Jun 10, 2022 · 3 comments
Closed

Please support skipFetchSetup for BscscanProvider and EtherscanProvider #3067

tyuen opened this issue Jun 10, 2022 · 3 comments
Assignees
Labels
enhancement New feature or improvement. minor-bump Planned for the next minor version bump.

Comments

@tyuen
Copy link

tyuen commented Jun 10, 2022

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 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

@tyuen tyuen added the investigate Under investigation and may be a bug. label Jun 10, 2022
@ricmoo ricmoo added enhancement New feature or improvement. minor-bump Planned for the next minor version bump. and removed investigate Under investigation and may be a bug. labels Jun 30, 2022
@0xcaff
Copy link

0xcaff commented Sep 5, 2022

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

@zer0stars
Copy link

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.

How is options.skipFetchSetup enabled in 6.3?

@ricmoo
Copy link
Member

ricmoo commented Sep 13, 2023

@zer0stars

There is no such thing as skipFetchSetup in v6, since it doesn't do any setup like v5 did.

What do you mean by "skipping provider setup and falling back to regular fetch"?

(closing this now, as it is no longer relevant to v6, but please keep commenting if you are having issues ;))

@ricmoo ricmoo closed this as completed Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. minor-bump Planned for the next minor version bump.
Projects
None yet
Development

No branches or pull requests

4 participants