Google sheet TypeError

I'm using node red in Raspberry pi 3b+
Trying to Connect my google sheet to node red, But not Getting any data from Sheet

Getting below error

(node:361) UnhandledPromiseRejectionWarning: TypeError: response.data.values.flat is not a function
at /home/pi/.node-red/node_modules/node-red-contrib-google-sheets/gsheet.js:53:60
at createAPIRequestAsync.then.r (/home/pi/.node-red/node_modules/googleapis-common/build/src/apirequest.js:49:53)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:361) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Flow:
image

Followed same with other raspberry pi and its working out there

Tried Reinstalling Google-sheet
Rebooting PI

Nothing worked

What versions of node-red and nodejs are you using on the one that works and the one that doesn't? The node-red version is shown at the bottom of the menu dropdown. For the nodejs version open a terminal and run
node -v
Also which version of the gsheet node (check in Manage Palette)?

What version of node is your node-red server running in?

The flat function is not available in node < v11

On successful working pi
Node-red: 1.0.3
Nodejs: 10.15.2

Current pi
Node-red: 1.3.4
Nodejs: 10.24.0

Google sheet node : 1.1.0

That is quite surprising. Something else must be going on - my suspicion is something you have installed on the working pi has patched the Array prototype (naughty naughty) to support flat()

Either way, nodejs 10.x is End Of Life and no longer receives security updates so you should update nodejs regardless.

I suspect it will work on both PI with nodejs v12 or greater.


For reference, you can update latest node-red and nodejs at the same time using the official script (info is in the node-red online docs)

Okay, I'll update and check

Thanks for suggestion
It worked after node update
I've updated Node to 14.18.2 and node red to 2.1.4

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.