-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
MetaMask web3 instance doesn't return events/logs #2393
Comments
As an update to this issue: The problem was caused by faulty network switching within MetaMask See this stackoverflow: https://ethereum.stackexchange.com/questions/28747/cant-retrieve-event-logs-with-metamask-web3 I quit my browser and reopened my site, then everything worked. I'm happy to help out on either:
Cheers, Brian |
Also having this same problem on version 3.11.2 To be a bit more specific, MetaMask doesn't return any new events after the specified block number only when watching a specific contract address. If I watch without specifying a contract address, everything works fine This works as expected, for events before and after someBlockNumber:
These work for events on someBlockNumber, but not for any events created after someBlockNumber:
|
Having same issue, my Dapp is not receiving events anymore (using Ropsten). |
@Overtorment various combinations of quitting and reopening your browser, toggling networks back and forth, and other hack voodoo wand waving seem to do the trick. Good luck |
Is there any news about this issue ? Because I am still stuck with Metamask not getting any events from my contracts.. |
Still having the same problem on 3.12.0 |
Do you know if it is working on older version ? |
I have the same issue. Events are not being received by my application when using metamask (it works fine using Web3 connected to local RPC or Mist). It does not matter if I'm using one of the test networks or I'm connected to a local RPC server through the extension. |
Is there a version of metamask that resolves this issue? Quitting and restarting my browser didn't do it. p.s. it works just fine without metamask (fallback to local node) |
@rawadrifai try version 3.11.1 you would have to load it manually into the extensions list and there might be some other bugs in it as well. This was the version that fixes events/logs but introduced basic use errors. |
I have 3.12.0 and it's working now. thanks. |
I'm having a similar issue. If I set the |
that bug was caused in part by us switching our filter polyfill logic to this module, if you can find the issue in that, you’d fix it in MetaMask: |
Guys we need to get this out of the chrome extension.. it's not very practical. Do you guys have progress on that? |
@rawadrifai you reported that its working on
|
@kumavis it's very flaky to be honest, especially with events. We are developing dapps right now, and the metamask adoption is a limitation for many people. I don't know if something is cooking over at metamask, but I would think of a different solution that can operate in the background. Username/password that map to a keypair .. maybe.. and you can integrate that in your app. The main goal basically is not have the end user authenticate outside the app (the extension). I wish I had more clarity on the solution in my head. |
Hi there, I'm also having some issues with events in My code looks like this:
(repo: https://github.com/buhrmi/nuxt-dapp/blob/master/store/index.js#L58, contract i'm trying to watch: https://rinkeby.etherscan.io/token/0x695d5f6060a92d730382dd06e8c3fb1d4012a07d) But I don't see any events appearing on the console even though the transaction has been mined. Is it a problem with my code? Any help would be appreciated. Using |
Could this be related to MetaMask/web3-provider-engine#188 ? |
Okay, when I run it this way:
I get Is there something I can do to help out with that? |
We have noticed this bug keeps appearing in newer versions.
We believe that there may be an issue if you switch networks while it's trying to connect (i.e. sometimes it takes a while to load and you switch) and part of the code hangs without realizing you switched. This would cause metamask to look for events from the contract address on another network. |
My mistake. In 3.13.3 changing networks still causes events to stop reporting for me as well. However, it does appear to sometimes work, whereas before it never used to work. I tried some tests based on the comments made by @ChainSafe and it doesn't seem to matter how long I wait before switching between networks. It could be that if you switch quickly, it's more likely to fail. |
Just adding my 2 gwei to the conversation. I was not receiving contract events when using metamask, but events worked fine if i was connecting to local geth instance. A) make sure your contract address is lower cased. (i'm assuming metamask is doing some filtering that uses your address and mine had upper case letters) After I made those changes I am able to see events coming through. Still a bit flaky, but better than nothing. |
Just spent half the day debugging why my DAPP frontend is not receiving events then found this issue. I can confirm this issue is still present in: 3.13.4 As already stated above, the following works as a solution - but hopefully we will get a fix:
|
I can confirm that this issue is present in 3.13.7, switching networks and restarting seems to help. Noticeable, perhaps related: Console.logging the contract event objects shows that arguments (including callbacks) passed through do not seem to be processed, but after doing the above they are. before restart: console.log(instance.setName({},{fromBlock: 0, toBlock: 'pending'},function(err,result){console.log(result)})); c {requestManager: s, options: {…}, implementation: {…}, filterId: null, callbacks: Array(0), …} after restart: console.log(instance.setName({},{fromBlock: 0, toBlock: 'pending'},function(err,result){console.log(result)})); c {requestManager: s, options: {…}, implementation: {…}, filterId: null, callbacks: Array(0), …} |
Is there a bug bounty or something on this? I'm willing to put in a few finney if it gets this fixed sooner. |
This issue now has a funding of 0.25 ETH (217.57 USD) attached to it.
|
I just added some funding! hopefully someone can tackle this. |
Work has been started on the 0.25 ETH (214.39 USD) funding by: Please work together and coordinate delivery of the issue scope. Gitcoin doesn't know enough about everyones skillsets / free time to say who should work on what, but we trust that the community is smart and well-intentioned enough to work together. As a general rule; if you start work first, youll be at the top of the above list ^^, and should have 'dibs' as long as you follow through. On the above list? Please leave a comment to let the funder (@pelsasser) and the other parties involved what you're working, with respect to this issue and your plans to resolve it. If you don't leave a comment, the funder may expire your submission at their discretion.
|
@lazaridiscom - yea, sorry my requirement doesn't really help alot since we would have to wait for this fix to make it into a new release. So I can remove that requirement so you can get paid in a timely fashion. I can show you how to produce the error with our environment pretty easily - it is part of this issue here Feel free to contact me phil@marketprotocol.io and I can help you get our development environment up to see the issue if you decide to go that route. |
@lazaridiscom Glad to see you're trying to help here! Note that there are likely several bugs around events. The issue you just linked to looks different from what people are talking about here. The two main bugs I observed in this thread are:
For a repro of the latter issue:
To see the demo actually working properly, restart the browser (or disable/enable MetaMask) once you're on Ropsten and then don't switch networks after that. My repro works fine against Contract source: pragma solidity ^0.4.19;
contract Counter {
uint256 public count = 0;
event Increment(address who); // declaring event
function increment() public {
Increment(msg.sender); // logging event
count += 1;
}
} |
@lazaridiscom I tested your change (https://github.com/MetaMask/metamask-extension/pull/3224/files) and it appears to fix the problem on my end |
Work for 0.25 ETH (214.25 USD) has been submitted . If you are the claimee, please leave a comment to let the funder (@pelsasser) (and the other parties involved) that you've submitted you work. If you don't leave a comment, the funder may expire your submission at their discretion.
|
@lazaridiscom Seems like your changes fixes this issue. |
@lazaridiscom - thanks for the patience, releasing funding now. |
use the providers initial _blocktracker (fixes #2393)
The funding of 0.25 ETH (210.74 USD) attached to this issue has been approved & issued .
|
I can't get logs from my contract. The following code works fine with the default web3 implementation that comes with truffle:
But when I run the same code in a browser using the MetaMask version of web3, nothing happens. The promise never returns, and nothing is ever even sent to the network.
For example in the truffle web3 instance, the following requests are logged by testrpc:
But when using the MetaMask implementation, nothing is even submitted to the testrpc instance.
I read the compatibility guide and am following it pretty closely. I can send transactions and call contracts just fine. I simple can not filter events.
The web3 version MetaMask is injecting is
0.20.2
and the version that truffle builds with is0.16.0
. Hopefully web3 doesn't have any breaking changes in minor versionsThe text was updated successfully, but these errors were encountered: