0

I keep getting this error "cannot read properties of undefined (reading 'WebSocketProvider')"

this is my code

require('dotenv').config()

const ethers = require('ethers')
const { BigNumber, utils } = ethers

const provider = new ethers.providers.WebSocketProvider(
  `wss://goerli.infura.io/ws/v3/${process.env.INFURA_ID}`,
  'goerli',
)

1 Answer 1

1

What version of ethers.js you are using? Try downgrading your ethers to v5.4.0 and check if it's working.

You can find more details in this post EthersJS Listening to events with NodeJS Strange Errors

1

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.