I am doing the Ethereum and Solidity: The Complete Developer's Guide and I am unable to resolve this error.

The code is expected to do a transaction via

await factory.methods
    from: accounts[0]

But it is not behaving properly and giving me the following error:

index.js?fccc903:155 Uncaught (in promise) Error: Provider does not have a request or send method to use.
    at RequestManager.module.exports.RequestManager.send (index.js?fccc903:155)
    at sendRequest (index.js?5b050cb:617)
    at Eth.send [as getAccounts] (index.js?5b050cb:644)
    at CampaignNew._callee$ (new.js?edc8855:17)
    at tryCatch (runtime.js?0e76910:62)
    at Generator.invoke [as _invoke] (runtime.js?0e76910:296)
    at Generator.prototype.<computed> [as next] (runtime.js?0e76910:114)
    at step (asyncToGenerator.js?ae4f0b1:17)
    at asyncToGenerator.js?ae4f0b1:35
    at new Promise (<anonymous>)

I remember the code was working fine, a few moments before, but now I am unsure why the error is occurring and the metamask window is not appearing. Please give your suggestions.

The new.js file for the code is:

import React, { Component } from 'react'
import { Container, Button, Form, Input } from 'semantic-ui-react'
import Layout from '../../components/Layouts'

import factory from '../../eth/factory'
import web3 from '../../eth/web3'

class CampaignNew extends Component {
    state = {
        minimumContribution: ''
    onSubmit = async (event)=>{

        const accounts = await web3.eth.getAccounts();
        await factory.methods
            from: accounts[0]

    render() {
        return (
                    <h1>Create a new Campaign page</h1>
                    <Form onSubmit={this.onSubmit}>
                            <label>Minimum contribution</label>
                                onChange={event => this.setState({minimumContribution: event.target.value})}

                        <Button primary>Create</Button>


export default CampaignNew;
  • 2
    Does this answer your question? Call contract view method from web3 Commented Dec 25, 2020 at 22:45
  • No, that did not answer the question. But I resolved it. (It's not a replicate as the cause of errors was different.)
    – Anupam
    Commented Dec 26, 2020 at 3:58

3 Answers 3


There was no problem with the send request that I have written. The problem was with the provider, which I have not assigned properly.

In my web3.js file, previously this was written:

web3 = new Web3(window.web3.currentProvider.enable());

I changed this to:

await window.web3.currentProvider.enable();
web3 = new Web3(window.web3.currentProvider);

You know I am doing this code from Intro to Blockchain Programming on youtube by Dapp University and.. I noticed I got this error. What solved it for me is that I added

var Web3 = require('web3')

var web3 = new Web3('<the IP of your blockchain, for me it was the RPC server address in ganache (that I'm using, you could be doing something different)>')

Just for newbies like I was: whatever in the <> is something you have to identify and enter by yourself.

The problem I was facing is that the provider was null and functions were also out. and I noticed that there must be something wrong in the package. So.. I went and did the tutorial for web3.js as well. And I found out this upper code. During the tutorial I also performed

npm install web3

which installed the necessary packages on my PC. You should try that out too if you havent yet and see what happens


I was facing the same error, I found a few additions to these answers so I'm posting another.

This error occurs when we pass a WRONG provider as an argument to instantiate Web3

const web3 = new Web3(THE_PROVIDER)

By wrong I mean, a provider which doesn't have a send() method, in most of the cases, which means we're not passing a valid provider.

For the newer Ethereum-compatibile browsers and latest metamask plugins:

We get the window.ethereum object which itself is a provider. We don't need window.web3.currentProvider to get the provider.

now as Ishan mentioned, we need to pass the "IP of our blockchain", that's completely true. BUT if we're using Metamask to connect to the blockchain, we need the provider they're injecting into the browser(window object). Then we use that provider, to instantiate Web3().

for that, we can just do:

const web3 = new Web3(window.ethereum); // Web3 needs the provider as argument

this will give no error, just one problem: we need accounts for transactions, and as of now if we do:

const accounts = await web3.eth.getAccounts();
console.log(accounts); // []

here the accounts array will be completely empty. WHY??

because we don't have access to the accounts from metamask/other providers. Anupam's answer is what we used to do, but

await window.ethereum.enable();
// or
await window.web3.currentProvider.enable()

enable() is deprecated now.

we need to use eth_requestAccounts to ask for provider's account access from the end user.

But we need to do it before we call Web3() constructor and pass the provider.


// asking for access to the accounts from the user
await window.ethereum.request({  // don't use send()
    method: "eth_requestAccounts"

// instantiating
web3 = new Web3(window.ethereum); 

console.log("accounts", await web3.eth.getAccounts()); // the accounts

Again I'll say don't use ethereum.send() in place of ethereum.request() as it's now deprecated, there will be a warning in your console.

One can follow this blog for a better understanding.

I actually wrote this answer, if someone in future had the same issue, I know Ishan's answer is perfect, But I just wanted to share why the error occurs, and how to fix it. As it took a long time for me to find the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.