Metamask-extension: 5.0.1 bug - web3.eth.coinbase is null, even when not in privacy mode

Created on 9 Nov 2018  路  16Comments  路  Source: MetaMask/metamask-extension

Describe the bug
A clear and concise description of what the bug is.

this is a bug in metamask 5.0.1 where if you toggle privacy mode on and then off again, it sometimes doesnt inject web3 anymore.

To Reproduce
Steps to reproduce the behavior:

  1. install metamask 5.0.1
  2. turn on privacy mode.
  3. turn off privacy mode.
  4. go to a site that should inject web3
  5. check for web3.eth.coinbase -- it will intermittently show as null

Expected behavior
A clear description of what you expected to happen.
check for web3.eth.coinbase -- it should NEVER be NULL when not in privacy mode

Screenshots
If applicable, add screenshots to help explain your problem.

screen shot 2018-11-09 at 3 56 48 pm

Browser details (please complete the following information):

  • OS: [e.g. iOS] Mac OS X 10.12.6 (16G1510)
  • Browser [e.g. chrome, safari] Chrome
  • MetaMask Version [e.g. 4.9.0] 5.0.1
  • Old UI or New / Beta UI? new UI

Additional context
Add any other context about the problem here.
GITCOIN 4 LYFE

Most helpful comment

Follow the step to reconnecting host on chrome Metamask plugin
connection

All 16 comments

Same problem here. Do you guys even test anymore?

Have you refreshed the page after turning privacy mode off?

Same problem here!

Browser details

  • OS: Mac OS X 10.13
  • Browser: Chrome Canary (72.0.3606.0 - Official Build 64-bit)
  • MetaMask version: 5.0.1
  • Old UI or New / Beta UI? New UI

Do you guys even test anymore?

don't be a jerk. metamask provides this software for free and is one of the most successful apps, measured by adoption, in the space; acting entitled to bugfixes doesn't help anything.

Have you refreshed the page after turning privacy mode off?

yes, i'm still seeing the intermittent problem then. steps to reproduce:

  1. go to site
  2. toggle privacy mode off <> on <> off (and leave it off)
  3. refresh page & paste web3.eth.coinbase in console
  4. repeat step 3 up to 3 times

Thanks for the report @owocki. We've identified the underlying problem and we're working on a fix now.

Hi @owocki, @masterial, and @Anish-Agnihotri. We landed a fix for this issue and released it as part of MetaMask v5.0.2. We're currently in the process of pushing this version out to users, so your extension should auto-update shortly.

In the meantime, you can verify the fix by manually installing one of the builds from #5718. Thanks again for reporting this issue, apologies for any downstream disruption it caused.

sorry to be a negative nancy @bitpshr @Anish-Agnihotri @danfinlay but i still see this issue with 5.0.2

screen shot 2018-11-14 at 11 25 24 am

@bitpshr @danfinlay any objections if we reopen issue?

Hi @owocki. No objections to reopening the issue.

Some additional context: calls to web3.eth.coinbase in MetaMask are always synchronous, but on initial page load, initial communication from the extension to our inpage provider does take a few milliseconds. This means calls made _immediately_ on load may return undefined in rare cases. It should also be noted that this was the case even before any 1102 implementation. It would be helpful to know 1) when you're checking web3.eth.coinbase during page load (in response to an onload event?) and 2) were you always checking web3.eth.coinbase in this manner prior to any 1102 integration on your end.

Thanks in advance for any additional information you can provide.

EDIT: I see now in your screen shot web3.eth.coinobase is returning null for a few seconds; this should never be the case. Trying to reproduce and debug on our end now, thanks @owocki.

i was just randomly hitting web3.eth.coinbase after page load.. dont know for sure if its before/after onload fired, but it was serveral seconds so i think it probably after onload

I see now in your screen shot web3.eth.coinobase is returning null for a few seconds; this should never be the case. Trying to reproduce and debug on our end now, thanks @owocki.

maybe infura was slow?

Also experiencing this. My MetaMask has privacy mode disabled and here's what I see:

console.log('web3 is found.');
console.log(' - accounts[0] is: ' + web3.eth.accounts[0]);
console.log(' - coinbase is:' + web3.eth.coinbase);

const approved_ = await ethereum._metamask.isApproved();
const enabled_ = await ethereum._metamask.isEnabled();
const unlocked_ = await ethereum._metamask.isUnlocked();

console.log('the metamask vars:');
console.log(' - approved: ' + approved_);
console.log(' - enabled: ' + enabled_);
console.log(' - unlocked: ' + unlocked_);

result:

image

I tried the new build generated from #5777 and it seems to fix my issues. Thanks @bitpshr . Eagerly awaiting the next release to be rolled out

which version number is this fixed in? im still seeing it today in 5.0.3

Hi @owocki. How exactly are you reproducing this now? Are you still just hitting web3.eth.coinbase on page load?

Before the fix in #5777, we were able to reproduce the issue with decent reliability by checking web3.eth.coinbase immediately on page load. This exposed a race condition in the way we handled an internal configuration store that only presented itself in production builds, which is what we addressed in #5777. We're unable to reproduce the issue when testing against that PR (or against develop / 5.0.3, which both include this fix, making debugging your specific case difficult.)

Is their some codebase you can share that exposes the issue reliably for you? Any additional context that would help us reproduce what you're seeing would help (if there's anything beyond web3.eth.coinbase in the console.) Thanks in advance.

IIRC, it was with a long-open browser tab/window.

let me try to reproduce over the course of this work week and let you know.

Follow the step to reconnecting host on chrome Metamask plugin
connection

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkOSullivan94 picture MarkOSullivan94  路  3Comments

beether picture beether  路  4Comments

1blockologist picture 1blockologist  路  3Comments

danfinlay picture danfinlay  路  3Comments

aakilfernandes picture aakilfernandes  路  3Comments