Server sometimes casts integers as strings

I was asked to put this issue up here for a fix:

Intermittently the server will reset my users tokens. There is no rhyme, reason or schedule that I can discern.

When this happens the users ratio gets reset to 0, and obviously this is a huge problem. One thing to note is that I manually “cheat” and constantly give my user fake ratio via the chrome console running the User.set() command.

It would be good to have more then one server so I could test better but I need to go Pro for that and am unable to at the moment.

Error: schema mismatch for _User.ratio; expected String but got Number
at SchemaController.enforceFieldExists (/moralis-server/lib/Controllers/SchemaController.js:1250:15)
at SchemaController.validateObject (/moralis-server/lib/Controllers/SchemaController.js:1391:28)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)

you get that error only sometimes?

Correct. Strange huh? For some reason, can call me crazy but I would look into the possibility that there is leakage between Nitro and the legacy database and cookie / cache. I remember in one of the updates that Ivan mentioned that one of the Nitro updates was to handle “real” integers as integers rather then having to cast them on the frontend as integers, and I talked to your product manager and she too mentioned that this was something she may have heard of.

I triggered a server update on your server now

Still happening but seems like it may be related to Parse cache in localStorage. I cleared some old remnants client side and will see if it fixes it for me.

1 Like

Do you know how to reproduce that?

Unfortunately (as mentioned) I cannot test this because I am on Mainnet with access to one server. I’m sacred that removing my remaining Parse cache would invalidate my user and I would have to buy a new plan with my product. Basically I’m locked into the Production flow and don’t have a test environment any longer. I cleared up a few staggering Parse keys in cache but left the main one responsible for my current user. It’s still happening though.

It’s very likely related to my activates building my product along with test servers and then switching to mainnet and logging on using the same machine I used to test with before.

What do you do when it happens?

AS MENTIONED.

One thing to note is that I manually “cheat” and constantly give my user fake ratio via the chrome console running the User.set() command.

I have super user access to the database field and I set it manually from the chrome console when it resets to 0.

That is used only as a fix after somehow it got set to 0?

I mean what do you do that causes that ratio to be set to 0.

do you still have same issue?