Invalid provider when using ZWeb3

:computer: Environment
Ganache: 6.7.0
@openzeppelin/upgrades: ^2.6.0
@openzeppelin/gsn-provider: ^0.1.9
@openzeppelin/test-helpers: ^0.5.3

When creating a new instance of TestHelper I get a:

Failed deployment of dependency @openzeppelin/contracts-ethereum-package with error: Provider not set or invalid

I’m using a GSN provider but the same error occours when deploying with a Local one.

I’m initializing the ZWeb3 instance with the web3 provider:

:1234: Code to reproduce

1 Like

Hi @seik & @ethicraul,

Welcome to the community @seik :wave:

I get the same error as you deployment failed with error: Provider not set or invalid at TestHelper()

Using Testing upgradeable projects documentation in a new project I can run a very simple test.


const { TestHelper } = require('@openzeppelin/cli');
const { Contracts, ZWeb3 } = require('@openzeppelin/upgrades');


const EthicHubDepositManager = Contracts.getFromLocal('EthicHubDepositManager');


contract('EthicHubDepositManager', function () {

  beforeEach(async function () {
    this.project = await TestHelper();

  it.only('should create a proxy', async function () {
    const proxy = await this.project.createProxy(EthicHubDepositManager);


pragma solidity 0.5.13;

import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/GSN/GSNRecipient.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/ownership/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol";

// import "../interfaces/IContributionTarget.sol";
// import "../storage/EthicHubStorageInterface.sol";

contract EthicHubDepositManager is Initializable, Ownable, GSNRecipient {

    uint8 public version;
    //EthicHubStorageInterface public ethicHubStorage;

    IERC20 public stableCoin;

    function initialize(
        address _ethicHubStorage, address _stableCoin
    ) public initializer {
        require(address(_ethicHubStorage) != address(0), "Storage address cannot is zero address");


        //ethicHubStorage = EthicHubStorageInterface(_ethicHubStorage);
        version = 1;

        stableCoin = IERC20(_stableCoin);

    function acceptRelayedCall(
        address relay,
        address from,
        bytes calldata encodedFunction,
        uint256 transactionFee,
        uint256 gasPrice,
        uint256 gasLimit,
        uint256 nonce,
        bytes calldata approvalData,
        uint256 maxPossibleCharge
    ) external view returns (uint256, bytes memory) {
      return _approveRelayedCall();

    function _preRelayedCall(bytes memory context) internal returns (bytes32) {

    function _postRelayedCall(bytes memory context, bool, uint256 actualCharge, bytes32) internal {

    function contribute(address target, address contributor, uint256 amount) public {
        require(contributor != address(0), "Contributor address is zero address");
        // require(
        //     address(target) == ethicHubStorage.getAddress(keccak256(abi.encodePacked("contract.address", target))),
        //     "Not a valid lending contract address"
        // );
        // require(
        //     ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "investor", contributor))) ||
        //     ethicHubStorage.getBool(keccak256(abi.encodePacked("user", "representative", contributor))),
        //     "Contributor is not registered lender or borrower"
        // );
            stableCoin.balanceOf(_msgSender()) >= amount &&
            stableCoin.allowance(_msgSender(), address(this)) >= amount,
            "No balance allowed to transfer or insufficient amount"
            amount > 0, "Amount cannot be 0"

        require(stableCoin.transferFrom(_msgSender(), address(target), amount), "transferFrom dai failed");
        //IContributionTarget(target).deposit(contributor, amount);

    function setRelayHubAddress(address relayAddress) public onlyOwner {

Unfortunately I haven’t been able to spot what the issue is in the existing project. Hopefully someone in the community might be able to assist.

Hi @seik & @ethicraul,

Can you try removing package-lock.json, delete node_modules directory and run npm install and try again?

I did this and no longer have the error with Provider not set or invalid

Hi @seik & @ethicraul,

Did the above resolve the issue that you were having?

That solved the issue @abcoathup, thanks!

1 Like

Hi @seik,

Thanks for letting me know. Glad it is resolved now.