MetaMask / MetaMask/metamask-extension
Setting "Enable on Click" causes MetaMask to silently fail
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Describe the bug**
In the Chrome Extensions settings page, setting MetaMask to "Enable on Click" instead of "Enable on all Sites" causes MetaMask to silently fail.
With "Enable on Click" set, even once MetaMask is enabled on a site, it will make a POST + Preflight request to Infura in the backend, which fails with a CORS error.


With "Enable on all Sites" checked, there is no Preflight check, it's just a POST:

**Steps to reproduce (REQUIRED)**
Steps to reproduce the behavior, libraries used with version number, and/or any setup information to easily reproduce:
1. In Chrome, navigate to chrome://extensions/
2. Toggle Developer mode to ON
3. Click into the MetaMask settings page
4. Select Site access > On click
5. Open up [Uniswap](https://app.uniswap.org/#/swap)
6. Click the MetaMask icon to enable it, and reload the page
7. Enter an ETH amount and select a destination token. **Note that no tokens load**
8. Go back to the MetaMask settings page and click the background.html link under Inspect views
9. **Observe the POST + Preflight errors**
**Expected behavior**
MetaMask works with "Enable on Click"
**Browser details (please complete the following information):**
- OS: macOS 10.15.7
- Browser: Chrome version 90.0.4430.212 (Official Build) (x86_64)
- MetaMask Version: 9.5.2
**Additional context (Error Messages, etc.)**
This used to work, but broke at some point in the past couple of weeks.
Contributor guide
Research direction
Reproduce the issue in Chrome using the MetaMask settings page and Uniswap, then inspect the background.html entry point and its POST and preflight errors to Infura. Done means MetaMask works with Site access set to On click, the request no longer fails with CORS, and Uniswap tokens load.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- networking, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100