Closed jamesmorgan closed 1 year ago
TBH - looking at this again I guess it may be a HD wallet issue?
@jamesmorgan Can you give some more details about what you were doing so we can try and reproduce/troubleshoot the problem? What version of Truffle are you using? I assume you are not using the most recent version as you need to be using a version of node >= 8.9.4
. Consider upgrading the most recent version of Truffle (and a more recent version of node :) ).
Ah ye, sorry I copy pasted into the wrong bit, this is my output, I am using a new version of truffle:
truffle version
Truffle v5.0.5 (core: 5.0.5)
Solidity v0.5.0 (solc-js)
Node v8.9.4
I was just deploying several fairly large contracts to mainnet from truffle - this is the command I used, I had 4 migrations to run in total truffle compile; truffle migrate --network live;
live
is an option in my truffle config which looks like this:
live: {
provider: function () {
return new HDWalletProvider(process.env.MNEMONIC, `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`);
},
network_id: 1,
gas: 6075039,
gasPrice: 7000000000,
timeoutBlocks: 200,
skipDryRun: true
},
I have been using truffle for a long time and have never seen this message so thought I would raise it.
@jamesmorgan I'm not familiar with this error either. Is your codebase available somewhere?
@jamesmorgan By the way, are you using a legacy infura endpoint? Sounds like it could be the result of you not using the new format? Let me know.
@eggplantzzz nope I was using the V3
endpoint and I havent seen the error since reporting this. Maybe it was a networking issue which surfaced as the error?
Huh, very weird. Well I guess it is nice when problems seem to fix themselves. Maybe it was just an infura blip or something. Closing this for now, if it surfaces again feel free to open another!
I had the same issue when deploy a contract on Rinkeby network, although the contract was deployed successfully.
Error: legacy access request rate exceeded
at /Users/viking/ethereum/project/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modules/web3-provider-engine/subproviders/provider.js:18:1
How to fix it?
Here is a part of truffle.js
:
rinkeby: {
provider: () =>
new HDWalletProvider(mnemonic,"https://rinkeby.infura.io/v3/"+PROJECT_ID, 2),
network_id: 4,
gas: 6e6,
gasPrice: 2e9,
},
Operating System: OXS Ethereum client: Truffle/Infura Truffle v5.0.27 node: v8.15.1 Solidity v0.5.11 (solc-js)
I had the same issue when deploy a contract on Rinkeby network.
Error: legacy access request rate exceeded
at /Users/viking/ethereum/project/node_modules/truffle-hdwallet-provider/dist/webpack:/truffle-hdwallet-provider/Users/gnidan/src/work/truffle/node_modules/web3-provider-engine/subproviders/provider.js:18:1
How to fix it? here is a part of truffle.js
rinkeby: {
provider: () =>
new HDWalletProvider(mnemonic,"https://rinkeby.infura.io/v3/"+PROJECT_ID, 2),
network_id: 4,
gas: 6e6,
gasPrice: 2e9,
},
Operating System: OXS Ethereum client: Truffle/Infura Truffle v5.0.27 node: v8.15.1 Solidity v0.5.11 (solc-js)
I’m also having this problem with truffle migrate using latest Truffle 5.1.0
const HDWalletProvider = require('@truffle/hdwallet-provider')
module.exports = {
networks: {
ropsten: {
provider: new HDWalletProvider(process.env.MNEMONIC, 'https://ropsten.infura.io/v3/' + process.env.INFURA_PROJECT_ID),
gas: 4700000,
network_id: 3
},
},
migrations_directory: './migrations',
};
Hi @guix77, can you confirm that your Infura Project is set to use Project IDs? (See https://community.infura.io/t/legacy-key-deprecation/443)
Based on your code snippet it looks it already uses Project IDs, but wanted to double-check. 🙂
Hi @CruzMolina, yes I set up a project in my Infura account, and in my .env I have :
INFURA_PROJECT_ID=abcd...
I tried with "" too and with wss:// but this one does not seem to be implemented.
Furthermore on my Infura account I can see my amount of requests attached to this project.
The error is consistently :
⠼ Saving migration to chain.Error: legacy access request rate exceeded
at /home/guix/dev/my-smart-contracts/node_modules/web3-provider-engine/subproviders/provider.js:18:36
at XMLHttpRequest.request.onreadystatechange (/home/guix/dev/my-smart-contracts/node_modules/@truffle/hdwallet-provider/node_modules/web3-providers-http/src/index.js:102:13)
at XMLHttpRequestEventTarget.dispatchEvent (/home/guix/dev/my-smart-contracts/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest._setReadyState (/home/guix/dev/my-smart-contracts/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest._onHttpResponseEnd (/home/guix/dev/my-smart-contracts/node_modules/xhr2-cookies/xml-http-request.ts:345:8)
at IncomingMessage.<anonymous> (/home/guix/dev/my-smart-contracts/node_modules/xhr2-cookies/xml-http-request.ts:311:39)
at IncomingMessage.emit (events.js:198:15)
at endReadableNT (_stream_readable.js:1139:12)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
Hey @guix77, two things that come to mind:
In some cases not having the provider be a function causes issues (though I forget exactly what the conditions are!). So your network config should look something like
ropsten: {
provider: function() {
return new HDWalletProvider(....blah blah....);
},
network_id: 3,
etc.....
Oh, and also make sure you are using the most current version of HDWalletProvider. Let me know if you have any success!
I did get the same error message and switched my web3.js dapp towards v3 while generating a fresh API-ID. Then it worked for me. BTW, I did slow down the firing of requests towards Infura. It also helped. It seems that Infura load-balancing or some sort of middleware takes a bit of time between different calls. After a deployment of a contract, e.g., I really need to wait a bit (for confirmations) before I can access the contract and fire read/get calls. A locally running node is always more responsive and produces less error messages.
Thanks for the confirmation @pepihasenfuss that v3+fresh ID works.
I'll leave this open because it sounds like there's documentation to improve on our side. Can others confirm that @pepihasenfuss's fix works?
Would love this to stop being a source of confusion.
Closing for issue maintenance. It's been fixed in the Truffle boilerplate projects as well as the Truffle suite website.
Issue
Today, when deploying contracts to mainnet I have received the following error whilst using truffle deploy
Error: legacy access request rate exceeded
Steps to Reproduce
Deploy a new contract to main.
Expected Behavior
No exceptions
Actual Results
Sample stack trace I get:
Environment
truffle version
):node --version
):v5.0.5
npm --version
):6.5.0