We encountered the following error while running a self-hosted Moralis server.
Server log:
error: Invalid function: "watchContractEvent" { "code": 141, "stack": "Error: Invalid function: \"watchContractEvent\"\n at handleCloudFunction (/usr/src/app/node_modules/parse-server/lib/Routers/FunctionsRouter.js:118:13)\n at /usr/src/app/node_modules/parse-server/lib/PromiseRouter.js:85:20\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)" }
We were calling watchContractEvent
Cloud Function via:
import Moralis from 'moralis-v1/node'; Moralis.Cloud.run("watchContractEvent", options, { useMasterKey: true })
Our self-hosted Moralis server is setup following these instructions, specifically this and the server code is from here.Looking the generated Cloud Function codes at build/cloud/
directory (after running yarn build
), there is no watchContractEvent
generated.
According to the Moralis docs:
Moralis Server has a special cloud function called
watchContractEvent(options)
. You can call it using the master key.
Since Moralis Server (i.e. “Dapp Server”) is discontinued, how do we similarly have this “special cloud function” in our self-hosted server?