question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update docs to be more clear about deployer function arguments

See original GitHub issue

I’m trying to deploy contracts to ganache, using truffle migrate. One of my contracts requiring to get accounts addresses as constructor parameter

When I try to use

module.exports = function(deployer, network, accounts) {
 // Use the accounts within your migrations.
} 

and trying deploy like this:

module.exports = function(deployer, accounts) {
 // deployer.deploy(SimpleStorage);
 deployer.deploy(KNS).then(function() {
  console.log(accounts);
  console.log(accounts[0]);
  return deployer.deploy(SuperFactory, KNS.address,accounts[0],accounts[0]);
});
};

it falis with invalid address.

console.log(accounts) just print me string ganache

Expected Behavior

migration successful, or at least console.log should return me Promise of accounts array (the same way as I would invoke web3.eth.getAccounts() )

I also should note, that when I’m invoking web3.eth.getAccounts() manually - it works fine, but when I’m trying to get accounts from module.exports it returns me that ganache string and nothing else

Current Behavior

accounts contain simple string ganache and nothing else

Possible Solution

Check out accounts from module.exports or check out ganache accounts accesability.

Your Environment

Truffle v.5.1.12

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JackBekketcommented, Feb 13, 2020

Oh, I just found where bug is

module.exports = function(deployer, network, accounts) {
 // Use the accounts within your migrations.
} 

module exports always think, that second parameter is a network, and third parameter is accounts.

If I don’t need network parameter for deploy and only need accounts – I should cast it as third parameter to module.exports

0reactions
gnidancommented, Mar 4, 2020

Yep! I’ll update this issue accordingly! Thanks @JackBekket

Read more comments on GitHub >

github_iconTop Results From Across the Web

gcloud functions deploy | Google Cloud CLI Documentation
Overview · apply-parameters · apply-software-update · create · delete · describe · list · reschedule-maintenance · update. operations.
Read more >
Manage functions | Cloud Functions for Firebase - Google
You can deploy, delete, and modify functions using Firebase CLI commands or by setting runtime options in your functions source code.
Read more >
wighawag/hardhat-deploy - GitHub
This also results in much clearer tests and deployment scripts (no more ... the list of argument for the constructor (or the upgrade...
Read more >
Run Migrations - Truffle Suite
The function exported by each migration should accept a deployer object as its first parameter. This object aides in deployment by both providing...
Read more >
az functionapp | Microsoft Learn
Delete an existing function app's container settings. ... az functionapp deployment source update-token ... Check out help for more examples.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found