-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Failed to deserialize response: expected value at line 1 column 1 #4865
Comments
we already set this foundry/config/src/etherscan.rs Lines 276 to 277 in e15e33a
we check for various cloudflare errors, but this one we're missing apparently, do you know what kind of error is returned? |
ah thanks for pointing me to that. I was on an older build but just now built again from source on the EC2. about to test Not 100% sure the kind of error returned as it doesn't seem like a regular 403 error. But here is the html body that foundry couldn't deserialize.
|
Ah, unfortunately still getting the same response even with the latest build. |
Same issue |
Getting the same issue, any idea what it could be? Is this a goerli specific issue? |
Latest comms from the Etherscan API team made it seem like this is an issue they are aware of and their suggested User Agent fix doesn't quite work from my testing. No response back about that. Seems to also be affecting Aribtrum Goerli (which uses etherscan). I have yet to try on mainnet fully but my initial testing went a lot better on mainnet so it seems restricted to goerli at least. |
I have been suspecting that there was an issue with my script or with my local environment until I spent nearly an hour and finally discovered this thread...
I have been suspecting that there was an issue with my script or with my local environment until I spent nearly an hour and finally discovered this comment... |
Looks like it's broken on Gnosis as well - @mpeyfuss did you find a fix for Arbitrum Goerli? |
@mattsse Would it be possible to take a look at this? Contract verification via the CLI for chains outside of mainnet seems to be broken |
Hey @ratankaliani — we have a fix for contract verification on ethers-rs, we just need to upstream. It'll be done in the upcoming days |
See you again. lol. any update on this issue? |
@Evalir can you link the upstream fix on ethers-rs so we can monitor and test? |
Hmmm these fixes might have not circumvented this particular issue @mpeyfuss, but we do have the user agent string in place. We'll look into this to ensure we're not overlooking anything, even though it's particularly hard to test if this only happens from a remote instance—i cannot reproduce locally. Is everyone who has commented on this issue running forge on a remote instance? Or is someone getting this locally? If so, it might be a different issue. |
Issue has resolved for me - I was able to deploy & verify contracts on Optimism Goerli earlier today. |
@Evalir yeah totally understood. It seems like the user agent string has not worked and I suspect this has to do with Cloudflare blocking the AWS IP range or something to that extent. The issue still persists with the latest build. Definitely hard to test locally 😂 Is the foundry cloud build on ubuntu working with verification? Can't remember if contract verification to etherscan is tested in the github action off the top of my head. |
Ah I think it was tested on the live tests, but we recently removed them, so not anymore :( |
@mpeyfuss Ah, working with Goerli today & yeah seems like Cloudflare is still blocking it even with the latest build. |
I can confirm this issue does not exist for mainnet eth, only testnets it seems. Not sure there is much we can do but we should keep this open until the Etherscan team gives an update. |
Same issue here |
@Evalir just wanted to bump this thread again |
Same error with forge script broadcast on Sepolia |
the same here in goerli:
|
looks like the etherscan API response with an error or cloudflare page... do you have the full response? |
This is the full response:
|
Running into this same issue today as well on Goerli even after running
Forge scripts on Goerli are failing too. |
@mattsse Is there a release of foundry with the above PR merged? |
next nightly I also think we should consider calling a random etherscan API request first before deploying so we can check if there are issues wdyt? |
Yeah I agree, would be good to add to these tests or a similar nightly suite to detect when there are Cloudflare errors. |
Etherscan verification for non-mainnet chains requires a question mark at the end of the verifier url in order to prevent a forward slash from being added to the url which trips a cloudflare rule on requests from ec2 boxes. Verification on both Goerli and Sepolia both fails without this character present. Hardhat-verify does not add the extra forward slash to the verifier url and has no issues verifying contracts on etherscan. Fixes foundry-rs#4865, foundry-rs#5251, foundry-rs#5741
* fix `forge verify-contract` etherscan cloudflare bug Etherscan verification for non-mainnet chains requires a question mark at the end of the verifier url in order to prevent a forward slash from being added to the url which trips a cloudflare rule on requests from ec2 boxes. Verification on both Goerli and Sepolia both fails without this character present. Hardhat-verify does not add the extra forward slash to the verifier url and has no issues verifying contracts on etherscan. Fixes #4865, #5251, #5741 * run cargo +nightly fmt -- --check * check if the api url already ends with ? Also apply the fix to --verifier-url urls
I am having a similar issue with Sepolia. Does anyone have a fix for this? |
If you are using Infura change to Alchemy, it solved my issue. |
using Alchemy, have the same issue |
I am still having this issue on Alchemy when deploying upgradeable UUPS contracts, any ideas? |
The RPC provider shouldn't affect the verification request to Etherscan, which is what this issue calls out. If you are trying to send Etherscan requests from share IP ranges, such as on AWS, their API will likely detect and try to mitigate a bot, especially on testnets. Verifying from a personal computer should pretty much always work. |
Having the same issue today. |
Same issue on Binance Smart Chain
Out:
|
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (8307d6d 2023-04-20T00:05:51.425008000Z)
What command(s) is the bug in?
forge verify-contract
Operating System
Linux
Describe the bug
I am running forge in an AWS EC2 instance and on verification keep getting a 403 error from Etherscan which results in the
Failed to deserialize response: expected value at line 1 column 1
error as it returns html with a captcha rather than json.I've reached out to Etherscan and this was their response:
My understanding is that reqwest doesn't set a default User-Agent header and so CloudFlare decides to block my request.
Does anyone know of a way to add a User-Agent header to outgoing requests on forge?
This seems like it currently affects just a small subset of users, although it would future proof everyone if a default user agent was set by forge/foundry. For example, curl automatically applies a default user agent so it would make sense for forge/foundry to do the same.
The text was updated successfully, but these errors were encountered: