kevinschaich / mintable

🍃 Automate your personal finances – for free, with no ads, and no data collection.
https://kevinschaich.io/mintable/
MIT License
1.52k stars 200 forks source link

TypeError: accounts.flat is not a function #108

Closed jmuthalaly closed 1 year ago

jmuthalaly commented 3 years ago

Steps to Reproduce:

  1. Set up Plaid integration
  2. Set up Google Sheets integration
  3. Add a few bank accounts
  4. Run mintable fetch

Error: 2020-10-07T04:11:28.556Z [INFO] Fetched 1 sub-accounts and 14 transactions. (node:11391) UnhandledPromiseRejectionWarning: TypeError: accounts.flat is not a function at /usr/local/lib/node_modules/mintable/lib/scripts/fetch.js:104:26 at step (/usr/local/lib/node_modules/mintable/lib/scripts/fetch.js:44:23) at Object.next (/usr/local/lib/node_modules/mintable/lib/scripts/fetch.js:25:53) at fulfilled (/usr/local/lib/node_modules/mintable/lib/scripts/fetch.js:16:58) at process._tickCallback (internal/process/next_tick.js:68:7) (node:11391) 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: 1) (node:11391) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

System Info:

arch: x64
platform: linux
os: v5.4.0-7642-generic
mintable: v2.0.1
node: v10.19.0
Michalos88 commented 3 years ago

Hey @jmuthalaly!

I was able to reproduce your error and fix it.

Basically your node version is too old. array.flat was introduced to node in 11.0.0 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat).

Upgrading to node >= 11.0.0, should fix it!

@kevinschaich, perhaps node >= 11.0.0, should be mentioned as requirement in docs. ☺️

Cheers!

gbdavidx commented 3 years ago

yes it should, you helped me with my issue!