[Recent version bug] Unexpected "NaN" error on Postgres node

Hello !

In 0.111.0, we had a simple workflow that called an API endpoint to get data, transform that data and insert it in a Postgres table. The workflow looked like this:

The workflow worked absolutely fined until we updated our version to 0.119.0.

Starting from that point, the “Execute workflow” throwed a formatting data “NaN” error on the last Postgres node.

BUT if we opened that node and click on “Execute node” everything worked perfectly fine and the data were inserted into the table correctly.

We thought maybe something was weird in our data formatting function and tried changing the code in various ways, the error persisted. We also looked directly into the workflow file and didn’t notice anything abnormal.

We then updated to 0.123.0 and now even the “Execute node” was throwing the “NaN” error, just like “Execute workflow”. At least it was consistent, but we still couldn’t figure why the code was suddenly not working.

In desperation we decided to rollback to 0.111.0 (not changing any piece of the workflow/code) and everything was absolutely fine again. The “Execute workflow” and “Execute node” didn’t throw any error.

We do not have any idea of what could cause this on the most recent versions.

Hey @Eliott_Audry!

Welcome to the community :sparkling_heart:

Did you check the changelog? We introduced Typecasting in v0.114.0. Not sure, but maybe that is the reason you are getting the error.

There was also a breaking change that got introduced in v0.118.0.

1 Like

Thank you for the suggestion !

We do not think that could be the issue.
If it can help, we are going to try to replicate the problem on an other instance with public data during the next days, and share the workflow here.

In v0.118.0 and v0.117.0 we made breaking changes in the Postgres node. I understand that you were using 0.111.0 so that is probably the case.

1 Like

Thanks for the suggestion !

After checking, we are currently in Node.js v12.
We will try to update the node version and try again, I’ll keep you informed if its now working : )

Hello again!

To keep you updated: We tried to upgrade our Node version to 14+ but the error persisted on the recent n8n versions. Unfortunately that wasn’t the problem.

But did you apply the changes to the postgres node?

I don’t think I understand what you mean by “applying the changes to the node”.
After upgrading Node.js and n8n to the last versions, I tried to execute the whole workflow again, and had the error.

I get that the nodes return values from all the queries now, but each Postgres node contains only one query.

Is there something more?

I meant to say If you had made the adjustments described in the “How to update” section per each breaking change.

Can you please share your workflow?

I have the same error but only to float Type.
After read query I casted field to float by parseFloat(fieldname) but I have some null value to the field too.
I update my item function from:

item.gpslat = parseFloat(item.gpslat)
item.gpslong = parseFloat(item.gpslong)
return item;

to

item.gpslat = item.gpslat ? parseFloat(item.gpslat):null
item.gpslong = item.gpslong ? parseFloat(item.gpslong):null
return item;

And now I have null against NaN to my field.