[SOLVED] Error while creation a object in Moralis Database


I receiced error “Failed to create new object, with error code: Object not found.” while executing next code:
const Game = this.moralis.Object.extend(“Game”);
const game = new Game();
game.set(“id”, gameId);
game.set(“state”, “bidding”);
game.set(“started”, now.valueOf());
game.set(“startPrice”, 0);
game.set(“endPrice”, 0);
await game.save();

In dashboard I can see that scheme (empty) Game is created, and in Log I have next: “2022-01-10T14:17:13.118Z - Error: Object not found.
at /moralis-server/lib/Controllers/DatabaseController.js:615:17
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)”

Could you say - what’s wrong?


it looks like I got no error for this code:

Game = Moralis.Object.extend("Game");
const game = new Game();
game.set("id", 10);
await game.save()

The same error. Nothing changes.

at what line you get that error with Object not found?

await game.save()

And this code works fine 3 days ago…

what is your server url/subdomain?


I think I found the reason.
I used field “id”, so Database tried to found record with same Id to update it.
After I changed to GameId everething is ok

1 Like