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

$ETHERSCAN_API_KEY present in .env seems to take priority over any --etherscan-api-key flags #6965

Closed
2 tasks
g-01234 opened this issue Jan 31, 2024 · 4 comments · Fixed by #6984
Closed
2 tasks
Assignees
Labels
T-bug Type: bug

Comments

@g-01234
Copy link
Contributor

g-01234 commented Jan 31, 2024

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (56e9583 2024-01-30T12:30:23.386976000Z)

What command(s) is the bug in?

cast storage --etherscan-api-key

Operating System

macOS (Apple Silicon)

Describe the bug

Just ran foundryup and started getting Invalid API key when running cast queries for non-mainnet chains (mainnet works fine).

I was running the commands from a directory with a .env file that contains various explorer API keys, named e.g. ETHERSCAN_API_KEY, BSCSCAN_API_KEY, etc.

The non-mainnet commands work when run from a different directory (without a .env), so it seems the .env:ETHERSCAN_API_KEY is getting picked up and used over anything else, even when I run e.g. cast storage 0xf7de7e8a6bd59ed41a4b5fe50278b3b7f31384df --etherscan-api-key $BSCSCAN_API_KEY --rpc-url $BSC_RPC_URL.

I believe it may be a result of this commit:
2249e07

@g-01234 g-01234 added the T-bug Type: bug label Jan 31, 2024
@gakonst gakonst added this to Foundry Jan 31, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Jan 31, 2024
@DaniPopes
Copy link
Member

cc @mattsse #6918

@mattsse mattsse self-assigned this Feb 1, 2024
@PaulRBerg
Copy link
Contributor

Just bumped into this issue while trying to verify a contract on Arbiscan.

I have an ETHERSCAN_API_KEY environment variable set globally on my machine, which seems to take priority over the flag passed to verify-contract.

It would make more sense to prioritize command-line options over environment variables.

@mattsse
Copy link
Member

mattsse commented Feb 1, 2024

sigh, sorry about this, should be fixed with #6984

@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Feb 1, 2024
@g-01234
Copy link
Contributor Author

g-01234 commented Feb 2, 2024

fixed, thanks king

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants