MetaMask / MetaMask/metamask-extension

Setting "Enable on Click" causes MetaMask to silently fail

Open
#11,099 1 comment 2 reactions 0 assignees View on GitHub
needs-research
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.

![image](https://user-images.githubusercontent.com/5861379/118288874-c047cd00-b50f-11eb-9a9e-6e09e69b03d3.png)

![image](https://user-images.githubusercontent.com/5861379/118288964-d3f33380-b50f-11eb-91c7-76069389da6c.png)

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

![image](https://user-images.githubusercontent.com/5861379/118289054-eb322100-b50f-11eb-91c1-5385308ef43e.png)

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.