Cannot read properties of undefined (reading 'toISOString')

Wappler Version : v5.4.3
Operating System : MacOs
Server Model: NodeJs
Database Type: mySQL (Maria DB)
Hosting Type: Local Server

Expected behavior

Paged database query return results.

Actual behavior

TypeError: Cannot read properties of undefined (reading 'toISOString')\n at formatRecord (../lib/core/app.js:362:75)\n at ../lib/core/app.js:390:45\n at Array.map (<anonymous>)\n at Object.options.postProcessResponse (../lib/core/app.js:390:31)\n at Client_MySQL.postProcessResponse (../node_modules/knex/lib/client.js:164:26)\n at ../node_modules/knex/lib/execution/runner.js:135:51\n at processTicksAndRejections (node:internal/process/task_queues:96:5)\n at async Runner.ensureConnection (../node_modules/knex/lib/execution/runner.js:300:14)\n at async Runner.run (../node_modules/knex/lib/execution/runner.js:30:19)\n at async App.paged (../lib/modules/dbconnector.js:587:20)

How to reproduce

  • Create a database view
  • Setup a paged query server action using the view

Note: This query works fine on v5.3.2… I’ve gotten the error on every update following that.

@patrick can you help with this please?

Does the view have some datetime columns in the output and are some of them perhaps null values?

Sorry I’m just getting back to you Patrick.
The view does have a datetime column in the output, but the column has no null values (I’ve just done a search).

I had actually set my default value for the column as ‘null’, but changed that when I looked up the error and found it was related to what you’ve mentioned.

Any other ideas buddy?
Thanks.

@patrick just upgraded to v5.5.0, no difference buddy.
Any other suggestions?

How are the fields recognized by Wappler, what does it show in the Database Manager?

Here you go @patrick

What do you think?

Was there any resolution to this problem? I’m hitting against this right now. All I’m trying to do is send a simple password reset email that works out the length of time between the POST event and NOW time, I think this is what is triggering the error above.

It works fine on my local server (Windows11) but not on the production server (Windows Server 2016) Using Wappler 5.6.1

Heres what Im using:

And here is my error:

{status: "500", message: "Cannot read properties of undefined (reading 'toISOString')",…}
message
: 
"Cannot read properties of undefined (reading 'toISOString')"
stack
: 
"TypeError: Cannot read properties of undefined (reading 'toISOString')\n    at formatRecord (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:362:75)\n    at C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:390:45\n    at Array.map (<anonymous>)\n    at options.postProcessResponse (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:390:31)\n    at Client_MySQL.postProcessResponse (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\client.js:164:26)\n    at C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:135:51\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Runner.ensureConnection (C:\\Inetpub\\vhosts\\xxxxxxxxxxcom\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:300:14)\n    at async Runner.run (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:30:19)\n    at async App.exists (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\validator\\db.js:7:25)"
status
: 
"500"

No, none that I know of.
I really don’t know exactly what triggered mine, but it started after a Wappler update.
That project is pretty much stuck on v5.3.2.

Did it work okay prior to v5.6.1?

As far as I can see it was working before 5.6.1, I took out the timediff set value item from Server Actions and still get the same error being triggered. Strange, as it works on the local copy but not the remote.
@patrick any ideas?

@patrick this is still throwing an error, as far as I can see I’m not using toISOString in this page yet this error is being thrown. I’m reluctant to spend much more time looking at it until we can confirm either way that this is or isn’t a bug.

Can you please advise?

What value does $_POST.SubTime return exactly?
Also have you tried disabling steps one by to see which one returns the error?

I’ve removed all the set value and the timdiff condition. Ive also taken the hyphen out of the POST name-dingbat

This one has me stumped, its working great on the local server but not in remote. I get the feeling a file has been missed during publish, but re-publishing multiple times throws the same error

Sorry, not sure i understand what you did.
Did you disable all the steps in your server action and after that you still get the error?

I removed any non essentials from the above, heres what I have now that’s still failing (but working locally):

Here is the error that is generated:

{status: "500", message: "Cannot read properties of undefined (reading 'toISOString')",…}
message
: 
"Cannot read properties of undefined (reading 'toISOString')"
stack
: 
"TypeError: Cannot read properties of undefined (reading 'toISOString')\n    at formatRecord (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:362:75)\n    at C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:390:45\n    at Array.map (<anonymous>)\n    at options.postProcessResponse (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\core\\app.js:390:31)\n    at Client_MySQL.postProcessResponse (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\client.js:164:26)\n    at C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:135:51\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Runner.ensureConnection (C:\\Inetpub\\vhosts\\rope-access-jobs.com\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:300:14)\n    at async Runner.run (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\node_modules\\knex\\lib\\execution\\runner.js:30:19)\n    at async App.exists (C:\\Inetpub\\vhosts\\xxxxxxxxxx.com\\httpdocs\\lib\\validator\\db.js:7:25)"
status
: 
"500"

So what if you disable (not delete) the database query step? Do you still see the same error?

I disable the step and still get he same error server side, local side sends the email,

Ok, probably @patrick should look into this in more details.

1 Like

Just one more idea… Every time I have restarted the local and remote NodeJS server after making changes, I haven’t fully rebooted the remote server, I’ll try that now and report back …

Update: Full remote server reboot didnt work.