After updating to the latest version, I’m getting this error:
{
"status": "500",
"message": "Cannot read properties of undefined (reading 'toJSON')",
"stack": "TypeError: Cannot read properties of undefined (reading 'toJSON')\n at formatRecord (/opt/node_app/lib/core/app.js:346:40)\n at /opt/node_app/lib/core/app.js:367:45\n at Array.map (<anonymous>)\n at Object.options.postProcessResponse (/opt/node_app/lib/core/app.js:367:31)\n at Client_PG.postProcessResponse (/opt/node_app/node_modules/knex/lib/client.js:162:26)\n at /opt/node_app/node_modules/knex/lib/execution/runner.js:142:51\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Runner.ensureConnection (/opt/node_app/node_modules/knex/lib/execution/runner.js:272:14)\n at async Runner.run (/opt/node_app/node_modules/knex/lib/execution/runner.js:30:19)"
}
I changed the aliases, but it didn’t solve the problem.
I was counting it with the date field, which was working before, but now it doesn’t.
It’s probably because of the updates regarding the datetime fields in the recent updates.
Changing the count aggregate to another property (company id in my case) solved the problem.
Are you sure it is the count field that is causing the error and not the date field? In the last update we updated how date fields are handled and that shouldn’t affect the count aggregate. Could you perhaps post the json of the action file.
Hi @patrick
I don’t think this is where an aggregate is used but when the query includes something that produces a date output. I have a server action that has stopped working all of a sudden, producing the same error in dev tools.
It draws a list of users and includes a DoB field (set as DATE not DATETIME), when that is included in the query, it produces the error @htatd shows above
In my case, it seems some invalid dates 0000-00-00 have crept in and adjusting those fixed the issue. I’m going to go back and check my form validations but maybe there’s a way of handling these exceptions?