Truffle Upgrades: Error on deployProxy - TypeError: Found non-callable @@iterator

Hi,

I’m trying to create a upgradeable contract, using the @openzeppelin/truffle-upgrades libray.
For that I’ve create a migration, but when I try to execute, truffle gives me this error:

TypeError: Found non-callable @@iterator
    at getInitializerData (@openzeppelin/truffle-upgrades/src/deploy-proxy.ts:61:46)
    at deployProxy (/truffle-upgrades/src/deploy-proxy.ts:43:16)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

:computer: Environment
Truffle v5.1.43 (core: 5.1.43)
Node v12.18.3
solidity 0.6.6
@openzeppelin/truffle-upgrades”: “^1.1.0”,

:1234: Code to reproduce
The migration that I create is the next:

const { deployProxy } = require('@openzeppelin/truffle-upgrades');

const Traceability = artifacts.require("Traceability");

module.exports = async function (deployer) {
  const instance = await deployProxy(Traceability, { deployer }, { unsafeAllowCustomTypes: true });
  console.log('Deployed', instance.address);
};
1 Like

Hi @ialberquilla,

If you change the parameters of deployProxy to include an empty array (as you aren’t passing any parameters to an initialize function), then you should be able to deploy.

const { deployProxy } = require('@openzeppelin/truffle-upgrades');

const Traceability = artifacts.require("Traceability");

module.exports = async function (deployer) {
  const instance = await deployProxy(Traceability, [], { deployer, unsafeAllowCustomTypes: true });
  console.log('Deployed', instance.address);
};
1 Like