@patrick have you had a chance to look at this yet…?
The error will probably happen when the database returns an invalid datetime. Can you check which query is generating the error and what the query returns for fields.
Is it a mySQL/MariaDB database? Check if the results perhaps have a datetime like 0000-00-00
, this will cause a parse error.
Its MariaDB on the remote server and we’re using the same database for local. This works fine on local but not on remote.
In addition ,there is no date formatting passing over in this section of code.
Date formatting happens internally on datetime fields from the database, they need to be formatted to a format app connect understands.
But I’m not using any date information during this. Date formatting on the database is DATETIME field 0000-00-00 00:00:00
Why would this work on the local server but not on the remote server both using the same DB? In addition, I use lots of actual date formatting in other areas with no issues at all. I’ve been through all the code again and again and cant find anything that would trigger the error I’m seeing.
MySQL/MariaDB can allow invalid date strings and have a special zero date string.
The problem with these dates is that Server Connect and App Connect can’t handle them and an error is generated when it is being parsed.
Perhaps in your local server you don’t have invalid dates while you have them in the remote server. It is also possible that the servers are not configured the same and the local server uses NO_ZERO_DATE SQL_MODE.
You can test this file, I check there for the zero date string and change it to 1000-01-01
.
app.zip (5.3 KB) unzip to lib/core
.
@patrick thanks for that, my SQL MODE isnt the problem as they are both using the same database, the MODE settings for it are:
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
However …
I restarted Wappler after replacing the file, then re-published the site, hard refreshed the browser, restarted remote NodeJS server then tried again - it worked!!
Your app.js workaround worked perfectly…!!
Many many thanks for sorting that one out, it’s a huge help.
As an additional bonus, it should also fix @IdrisE issue as well.
So, just one more question if you don’t mind, what happens with the next Wappler update? Will this file be updated as part of the new release? Or will I have to manually re-add it every time there’s new Wappler release?
It will not make it in today’s release, but I will make the needed changes so that it will be included in the next.
Fantastic.! Thanks for letting me know.
I’ve made some more changes in the file, I now convert zero dates to null values instead of setting the year 1000. Also I fixed an issue with clearing cookies from an other topic. Please test if I didn’t break anything.
app.zip (5.3 KB) unzip to lib/core
.
Thanks @TMR and @patrick.
Didn’t fix my issue though.
I think mine has something to do with paged queries.
Switched to custom query and error disappears… Just can’t figure out how to properly pass the limit and offset variables
I tested again with your new file, on Wappler 5.6.2 this time and it also worked perfectly.
@patrick What do you think buddy? Paged queries.
Wappler v6.0.5 Stable, MSSQL, NodeJS, Docker
I have come across the same issue when values in the product_description field contain a combination of alphanumeric characters and hyphens (database field type in MSSQL: varchar). These are the two examples of what’s failing and what’s working.
Failing with these product_description values:
- 48371-01-01 DXF
- GRM-AC0758-00-20 DXF
Working when the values above are modified by removing 1 hyphen between the 2nd and 3rd description segments.
- 48371-01 01 DXF
- GRM-AC0758 00-20 DXF
It seems the query is considering hyphens as minus
signs and as a result it is unable to display the query result as a varchar value.
Found the issue, the regexp for detecting date/time strings was not strict enough, in 48371-01-01 DXF
it detected the part 8371-01-01
as a date.
Have an update here:
app.zip (5.4 KB) Unzip to lib/core
.
Fixed in Wappler 6.1.1
This topic was automatically closed after 2 days. New replies are no longer allowed.