Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Provider not set or invalid." Error after transition from 1.0.0-beta.24 to 1.0.0-beta.27 #1253

Closed
mjhm opened this issue Dec 24, 2017 · 10 comments

Comments

@mjhm
Copy link
Contributor

mjhm commented Dec 24, 2017

This sample app works: https://github.com/mjhm/hello_world_dapp. (See README.md for install/run steps.)

UPDATE: I updated the example with the workaround mentioned below, so now the bug is exposed by removing this line https://github.com/mjhm/hello_world_dapp/blob/master/server.js#L55

However upgrading web3 from 1.0.0-beta.24 to 1.0.0-beta.27 causes it to fail

Unhandled rejection Error: Provider not set or invalid
    at Object.InvalidProvider (.../hello_world_dapp/node_modules/web3-core-helpers/src/errors.js:38:16)
    at RequestManager.send (.../hello_world_dapp/node_modules/web3-core-requestmanager/src/index.js:125:32)
    at sendRequest (.../hello_world_dapp/node_modules/web3-core-method/src/index.js:542:42)
    at send (.../hello_world_dapp/node_modules/web3-core-method/src/index.js:563:13)
    at Object._executeMethod (.../hello_world_dapp/node_modules/web3-eth-contract/src/index.js:819:24)
    at VotingContract.deploy.send.then (.../hello_world_dapp/server.js:54:71)
    at tryCatcher (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:497:31)
    at Promise._settlePromise (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:555:18)
    at Promise._settlePromise0 (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:600:10)
    at Promise._settlePromises (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:683:18)
    at Async._drainQueue (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:125:16)
    at Async._drainQueues (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:135:10)
    at Immediate.Async.drainQueues [as _onImmediate] (.../hello_world_dapp/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:16:14)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)

I'm pretty sure it was working for 1.0.0-beta.26 since I tried that out last week. Unfortunately I can't easily revert to that version because it appears the the sub modules all automatically upgrade to 1.0.0-beta.27

See the package-lock.json for the working version manifest.

@mjhm
Copy link
Contributor Author

mjhm commented Dec 27, 2017

So far it looks like I'm being tripped up by the changes from #1191

@mjhm
Copy link
Contributor Author

mjhm commented Dec 27, 2017

So it looks like Contract.deploy(...).send() creates a new contract instance but doesn't copy the provider to that instance. I can work around the issue with an explicit newContractInstance.setProvider(<original provider>), but this seems like something that should be fixed.

@comodoro
Copy link

I have run into this today, thanks for the quick workaround. If I were more into this, I would question the need of every Contract to have its separate Provider, but I guess it is too late now.

@MrTibbles
Copy link

I to ran into this. Pesky bugger.

@mjhm
Copy link
Contributor Author

mjhm commented Jan 27, 2018

Still broken with version 1.0.0-beta.29

@awgneo
Copy link
Contributor

awgneo commented Jan 30, 2018

+1 to broken still in 1.0.0-beta.29

@Thomas-K-John
Copy link

Thomas-K-John commented Feb 6, 2018

Yes.. I am also having this issue in web3@1.0.0-beta.29. Thanks for the workaround.

@Toeplitz
Copy link

Toeplitz commented Feb 8, 2018

Interesting bug? Thanks for this issue helping me out.

@frozeman
Copy link
Contributor

i merged the PR, hope that fixes it for typescript users

@mjhm
Copy link
Contributor Author

mjhm commented Feb 18, 2018

Confirmed fixed. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants