OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 200 forks source link

Provider not set or valid using zos-lib and truffle #1561

Closed bitcoinwarrior1 closed 4 years ago

bitcoinwarrior1 commented 4 years ago

Hi All, Thanks for your great work in creating these tools!

When running a basic suite of tests using zos-lib and truffle I get the following error:

Contract: Proxy "before each" hook: deploying legacy and upgradeable tokens for "has a name": Error: Provider not set or invalid

this happens even if I am running a ganache local node on the correct port.

Key details:

node version v10.21.0 zos-lib version ^2.4.3

Is this related to zos-lib or should I point my issue to truffle?

spalladino commented 4 years ago

Hey @James-Sangalli! Sorry to hear about that. Could you share a snippet of your code, to help diagnose the issue? Also, can you try out the latest @openzeppelin/upgrades library instead of the old zos-lib?

spalladino commented 4 years ago

Also, just in case, make sure you are initializing the library like this:

const { ZWeb3 } = require('@openzeppelin/upgrades') // or zos-lib
ZWeb3.initialize(web3.currentProvider)
bitcoinwarrior1 commented 4 years ago

Hi @spalladino, thank you for your help.

I upgraded the library to your suggestion and ensured the web3 provider was set correctly. All is well now, cheers!