How to add accounts to infura provider

Hi, so I’m just new to Infura.

My app works well locally but fails communicating with the contract through infura. After researching a bit. I found out that I had to setup accounts manually but I don’t know how to do this in my frontend app. I can do it easily with the console though using hard hat or truffle.

Any ideas? I’m using ethers.js to communicate with infura for my frontend app.


Hi @Jesse, and welcome to the Infura community!

Can you please paste your code (or send us your repo) so we can take a look at where you may be running into issues?

Hi I was also trying the same scenario.
here is my code git link:
if you see the


works file and I get value of


But when I run


I’m getting undefined for

I have even tried adding account to wallet via

// const signer = web3.eth.accounts.privateKeyToAccount( // process.env.SIGNER_PRIVATE_KEY // ); // console.log(" signer: ",signer) // web3.eth.accounts.wallet.add(signer)