[solved] useMoralisSubscription doesn't work

I’ve seen this solution, but my code still doesn’t work. Maybe I’m doing something wrong?

  const query = useMoralisSubscription('ReactTxs', q => q, [], {
    onCreate: data => {
      console.log('onCreate')
      console.log(data)
    },
    onUpdate: data => {
      console.log('onUpdate')
      console.log(data)
    },
    onEnter: data => {
      console.log('onEnter')
      console.log(data)
    },
    onLeave: data => {
      console.log('onLeave')
      console.log(data)
    },
    onDelete: data => {
      console.log('onDelete')
      console.log(data)
    },
    enabled: true,
  })

My db:
image

what happens? no console.log is triggered? did you restart the server after making those changes from that thread?

Yes, no logs
And yes, server was restarted

btw, code of parse server:

// @ts-ignore
import ParseServer from 'parse-server';
import config from './config';
import MoralisEthAdapter from './auth/MoralisEthAdapter';

export const parseServer = new ParseServer({
  databaseURI: config.DATABASE_URI,
  cloud: config.CLOUD_PATH,
  serverURL: config.SERVER_URL,
  publicServerURL: config.SERVER_URL,
  appId: config.APPLICATION_ID,
  masterKey: config.MASTER_KEY,
  auth: {
    moralisEth: {
      module: MoralisEthAdapter,
    },
  },
  liveQuery: {
    classNames: ['ReactTxs'],
  },
});

I am inserting documents into the database manually, but the log does not work.
Should they only be added by the server?

it should trigger when you add or modify a document from parse server dashboard interface

are there any logs to see if the subscription was created? you are trying that in backend or in front end?

I don’t have logs. I’m trying the frontend side.

So I have to add a new document from the server, just from the mongo interface it doesn’t work?

try to add it from parse server code, in some conditions it may not work if you add it directly in mongo db

Oh, it works fine
image

Thank you for your help and I apologise for disturbing you.

2 Likes