[SOLVED] Can't add object to database from node application

Hi there, I have been trying to add a new objects to a database class I just made but every time I try to connect to the db and add things I get the following error:

Error: Object not found.
at /moralis-server/lib/Controllers/DatabaseController.js:615:17
at processTicksAndRejections (node:internal/process/task_queues:96:5)

or from my local cmdline:

FailureParseError: 101 Object not found.

My database class has no permissions set on it and returns data when I query it so I at least know those aren’t the issue. Any idea on why this might be happening?


const data = require('./out.json')
const Moralis = require('moralis/node')

const serverUrl = "https://......." 
const appId = "........"

Moralis.start({serverUrl, appId})

const TokenClass = Moralis.Object.extend("CoinGeckoTokens");

let element = data[1]
let token = new TokenClass();
if (element.id && element.symbol && element.name) {
    token.set("id", element.id);
    token.set("symbol", element.symbol);
    token.set("name", element.name);
    token.save({useMasterKey:true}).then((_) => {
    }, (error) => {
        console.log("Failure" + error);

Figured it out right after I posted this. Turns out the id name conflicted with objectId. Changed it and now it’s working like a charm

1 Like

also you’re using in Node JS so use masterKey in your Moralis.start :raised_hands: that’ll enable you to pass the permissions in the backend~