========= NOTICE =========
Request-Rate Exceeded (this message will not be repeated)
The default API keys for each service are provided as a highly-throttled,
community resource for low-traffic projects and early prototyping.
While your application will continue to function, we highly recommended
signing up for your own API keys to improve performance, increase your
request rate/limit and enable other perks, such as metrics and advanced APIs.
I receive this notice regularly, even though I am using my personal Infura Project ID. I know for sure it’s using it because I see my requests getting charted in the Infura dashboard.
Since it says using your own API keys will improve performance etc, I want to get this working right.
What could be the reason that I’m getting this notice?
I’m using this code:
require("dotenv").config()
const Web3 = require('web3');
const web3 = new Web3(
new Web3.providers.WebsocketProvider(process.env.INFURA_URL)
);
Hi @James - if you’re using JS, it looks like your string interpolation may be incorrect - you would need to wrap your process.inv.INFURA_URL inside backticks and the ${ } string interpolation syntax like so:
const web3 = new Web3(new web3.providers.WebsocketProvider(`${process.env.INFURA_URL}`);
Let us know if you’re still running into this issue after trying that!
The call to the Uniswap SDK method ‘Token.fetchData’ here doesn’t specify the provider.
I just figured out from the SDK code that you can pass a provider as the third argument. If you don’t, it sets its own defaultProvider which will not use any personal API key.
However, when I pass web3.currentProvider (or web3.eth.currentProvider?) as the 3rd argument to Token.fetchData, I get an error “invalid signer or provider (argument=“signerOrProvider”, value=”[object Object]", code=INVALID_ARGUMENT,", so it is unclear to me how to do this.
According to the Uniswap docs, it should accept an ethers web3 provider as an argument, but your error is indicating it isn’t accepting that. I would double-check that you’re passing the correct type of object, and if that doesn’t work, it may be an SDK bug.
I’m seeing the same issue, I tried passing in web3.provider and it’s not throwing any errors, but still occasionally seeing the warning about default keys when i’m using my own api key
Hi @sterling000, and welcome to the Infura community!
How frequently are you seeing this warning message? Not sure why that would be happening when you’re using your own API keys, but want to know the frequency so we can figure out how to best figure out what’s going on