[SOLVED] How can I use web3 in Moralis cloud functions?

I saw some examples of using web3 in cloud functions. But it doesn’t work for me.

When I define a cloud function that uses anything related to web3, I get the following error:
ReferenceError: web3 is not defined

Is there something special that I’m supposed to do to make it work?

Here’s an example of a function that uses web3:

you can use now web3 in cloud code only with a custom RPC url

you have an example here:

Awesome it works now, thank you.

1 Like