[SOLVED] Moralis streams filter

Hi,
I’m trying to listen to token transfer on a ERC20 token. I’ve setted up a new stream service and I’m trying to add a filter allowing me to only listen to transfer towards a certain wallet. Here is the filter that I’m using

[
    {
      "topic0": "Transfer(address,address,uint256)",
      "filter": { "to": "WalletAddress"}
    }
  ] 

I have this error :
image

Apparently something is wrong, I’ve tried tweaks for hours with no success. Can you see something wrong in my code ?

Thank you in advance

this is the docs page for filters: https://docs.moralis.io/docs/filter-streams

you can try

eq: ['to', 'wallet']

Thank you
I would like to try it out but for some reason now, my webhook URL (that was working earlier) doesn’t work anymore.
Here is my webhook URL ( Using Moralis cloud function )
image
Here is the error I get :
image

I couldn’t find any specifications about webhooks on the doc, and I’ve tested my web hook ( Working properly when called from elsewhere ).

Any idea of what the issue could be ?

That server doesn’t have a cloud function called myFunction.

I know, I changed the function for my example
The function name is “processPayment”

What is the actual Webhook URL you are using?

The webhook has to receive POST requests and has to respond with status code 200

Here is the webhook I’m using : https://vddeposst2fr.usemoralis.com:2053/server/functions/processPayment

It is POST request ready and it sends statut 200 when the right data is sent in the body

can you test it with a CURL/postman request to see if it works as expected?

I did, that’s how I tested out my cloud function.
It’s working perfectly fine there

this is the error from the server for when I tried:

Nov 15 09:59:44Z vddeposst2fr.usemoralis.com moralis-server error: Failed running cloud function processPayment for user undefined with: 
Nov 15 09:59:44Z vddeposst2fr.usemoralis.com moralis-server    Input: {"abi":[],"block":{"number":"","hash":"","timestamp":""},"txs":[],"txsInternal":[],"logs":[],"chainId":"","confirmed":true,"retries":0,"tag":"","streamId":"","erc20Approvals":[],"erc20Transfers":[],"nftApprovals":{"ERC721":[],"ERC1155":[]},"nftTransfers":[]} 
Nov 15 09:59:44Z vddeposst2fr.usemoralis.com moralis-server   Error: {"message":"Cannot read properties of undefined (reading 'to')","code":141} {"functionName":"processPayment","error":{"message":"Cannot read properties of undefined (reading 'to')","code":141},"params":{"abi":[],"block":{"number":"","hash":"","timestamp":""},"txs":[],"txsInternal":[],"logs":[],"chainId":"","confirmed":true,"retries":0,"tag":"","streamId":"","erc20Approvals":[],"erc20Transfers":[],"nftApprovals":{"ERC721":[],"ERC1155":[]},"nftTransfers":[]}} 
Nov 15 09:59:44Z vddeposst2fr.usemoralis.com moralis-server  error: Cannot read properties of undefined (reading 'to') 

Ok I figured out the issue, to be able to bond to my web hook, I need the first interaction to send a code 200, so I’ve just commented all my cloud function code to returned a text ( no operation on data ), just so Moralis streams could process it the first time and let me create my stream
Thank you for your help :pray:

1 Like