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

Bug: v2.0.0 Beta - `mintable fetch` will not create new sheet tabs #71

Closed yawhide closed 4 years ago

yawhide commented 4 years ago

Hello,

I am trying to run mintable fetch and it creates only 1 tab Balances. It isnt created new tabs and putting transactions in it. I see this output:

2020-06-24T22:41:31.730Z [INFO] Using default configuration file `/Users/happy/mintable.jsonc.`
2020-06-24T22:41:31.731Z [INFO] You can supply either --config-file or --config-variable to specify a different configuration.
2020-06-24T22:41:31.732Z [INFO] Successfully opened configuration file.
2020-06-24T22:41:31.732Z [INFO] Successfully parsed configuration.
2020-06-24T22:41:36.696Z [INFO] Successfully validated configuration.
2020-06-24T22:41:36.715Z [INFO] Fetching account ********* using plaid.
2020-06-24T22:41:36.735Z [INFO] Fetching account ********* using plaid.
2020-06-24T22:41:36.736Z [INFO] Fetching account ********* using plaid.
2020-06-24T22:41:37.107Z [INFO] Fetched 1 sub-accounts and 0 transactions.
2020-06-24T22:41:37.198Z [INFO] Fetched 1 sub-accounts and 19 transactions.
2020-06-24T22:41:37.408Z [INFO] Fetched 1 sub-accounts and 36 transactions.
2020-06-24T22:41:38.263Z [INFO] Fetched 1 sheets.
2020-06-24T22:41:38.671Z [INFO] Added sheet Balances.
2020-06-24T22:41:38.948Z [INFO] Cleared 1 range(s): 'Balances'!A1:G4.
2020-06-24T22:41:39.222Z [INFO] Updated 1 range(s): 'Balances'!A1:G4.
2020-06-24T22:41:39.488Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.517Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.551Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.572Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.727Z [INFO] Fetched 2 sheets.
(node:4635) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'properties' of undefined
    at GoogleIntegration.<anonymous> (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:86:115)
    at step (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:33:23)
    at Object.next (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:14:53)
    at fulfilled (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4635) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4635) [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.
2020-06-24T22:41:39.762Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.815Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:39.894Z [INFO] Updated indices for 2 sheets.
2020-06-24T22:41:40.146Z [INFO] Fetched 2 sheets.
2020-06-24T22:41:40.517Z [INFO] Updated formatting for 2 sheets.

image

kevinschaich commented 4 years ago

Thanks @yawhide. I suspect this is originating from this line:

https://github.com/kevinschaich/mintable/blob/175ff519274a6c5252aa461ec1e426e90bd7e2a3/src/integrations/google/googleIntegration.ts#L89-L89

That's also the function which copies sheets – so makes sense that you are only getting one Balances sheet.

Looking into it for you. Do you have a template sheet set?

kevinschaich commented 4 years ago

@yawhide – I've added some more helpful error handling in #77 / v2.0.0-beta.33.

My hypothesis for the root cause here:

Sorry about that! Updated both the code and the beta instructions. 😄

yawhide commented 4 years ago

Yes my backup v1 config has the correct template sheet set (at least i assume it is correct, at the bottom of this comment i paste what the template sheet is) Ok so I reran the steps in #55 after updating mintable. I converted the original gdoc that I used above so I found an older sheet from v1 (this is why there were more transactions and sheets in the output below).

here is the output:

2020-06-28T01:02:58.736Z [INFO] Using default configuration file `/Users/happy/mintable.jsonc.`
2020-06-28T01:02:58.737Z [INFO] You can supply either --config-file or --config-variable to specify a different configuration.
2020-06-28T01:02:58.737Z [INFO] Successfully opened configuration file.
2020-06-28T01:02:58.737Z [INFO] Successfully parsed configuration.
2020-06-28T01:03:03.515Z [INFO] Successfully validated configuration.
2020-06-28T01:03:03.525Z [INFO] Fetching account CAN TIRE using plaid.
2020-06-28T01:03:03.532Z [INFO] Fetching account SIMPLII using plaid.
2020-06-28T01:03:03.532Z [INFO] Fetching account TD USA VISA using plaid.
2020-06-28T01:03:03.882Z [INFO] Fetched 1 sub-accounts and 0 transactions.
2020-06-28T01:03:04.017Z [INFO] Fetched 1 sub-accounts and 22 transactions.
2020-06-28T01:03:04.324Z [INFO] Fetched 1 sub-accounts and 82 transactions.
2020-06-28T01:03:05.319Z [INFO] Fetched 5 sheets.
2020-06-28T01:03:05.939Z [INFO] Added sheet Balances.
2020-06-28T01:03:06.754Z [INFO] Cleared 1 range(s): 'Balances'!A1:G4.
2020-06-28T01:03:07.180Z [INFO] Updated 1 range(s): 'Balances'!A1:G4.
2020-06-28T01:03:07.545Z [INFO] Fetched 6 sheets.
2020-06-28T01:03:07.566Z [INFO] Fetched 6 sheets.
2020-06-28T01:03:07.581Z [INFO] Fetched 6 sheets.
2020-06-28T01:03:07.606Z [INFO] Fetched 6 sheets.
2020-06-28T01:03:07.876Z [INFO] Fetched 6 sheets.
2020-06-28T01:03:07.876Z [ERROR] Error finding template sheet Template in document 10fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw.

 TypeError: Cannot read property 'properties' of undefined
    at GoogleIntegration.<anonymous> (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:87:119)
    at step (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:33:23)
    at Object.next (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:14:53)
    at fulfilled (/usr/local/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

You can check if anybody else has encountered this issue on GitHub:
https://github.com/kevinschaich/mintable/issues?q=is:issue+Error%20finding%20template%20sheet%20Template%20in%20document%2010fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw.

If this is a new issue, please use this link to report it:
https://github.com/kevinschaich/mintable/issues/new?title=Error:+Error%20finding%20template%20sheet%20Template%20in%20document%2010fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw.&body=**Steps%20to%20Reproduce:**%0A%0A1.%0A2.%0A3.%0A%0A**Error:**%0A%0A%60%60%60%0A%3CPaste%20Full%20Error%20Content%20Here%3E%0A%60%60%60%0A%0A**System%20Info:**%0A%0A%60%60%60%0Aarch:%20x64%0Aplatform:%20darwin%0Aos:%20v19.5.0%0Amintable:%20v2.0.0-beta.34%0Anode:%20v14.1.0%0A%60%60%60

Mac:mintable $

looks like it cannot find the template tab in your template sheet here: https://docs.google.com/spreadsheets/d/10fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw/edit#gid=196890266. Not sure why that would be.

kevinschaich commented 4 years ago

Thanks @yawhide – would you mind pasting the full templateSheet block of your config JSON below so I can do some digging?

Can you view the sheet with no problems in your browser? I believe I've granted public view-only access but perhaps something weird is going on.

yawhide commented 4 years ago

Thanks @yawhide – would you mind pasting the full templateSheet block of your config JSON below so I can do some digging?

{
...,
"TEMPLATE_SHEET": {
"SHEET_ID": "10fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw",
"SHEET_TITLE": "Template"
},
...
}

Can you view the sheet with no problems in your browser? I believe I've granted public view-only access but perhaps something weird is going on.

I am view the sheet no problem on my browser

kevinschaich commented 4 years ago

Thanks @yawhide – although that looks like it is a config block from v1.x.x? Did it get correctly migrated to your v2.x.x ~/mintable.jsonc config when you ran mintable migrate? The v2.x.x block should look like this:

"template": {
  "documentId": "...",
  "sheetTitle": "..."
}
kevinschaich commented 4 years ago

Hey @yawhide – I think I've found a fix for you in #83.

What I think was happening here: the documentId field of the template sheet config was not actually being used – it was fetching the sheets of your production sheet. So it could not find anything called "Template".

Assuming your config is actually the v2.0.0 version as described above, would you mind upgrading to v2.0.0-beta.35 and testing this out for me?

yawhide commented 4 years ago

Thanks @yawhide – although that looks like it is a config block from v1.x.x? Did it get correctly migrated to your v2.x.x ~/mintable.jsonc config when you ran mintable migrate? The v2.x.x block should look like this:

"template": {
  "documentId": "...",
  "sheetTitle": "..."
}

you are totally right, i was looking at the v1 config file, not the v2 config. here is what the v2 config looks like:

{
  "integrations": {
    "google": {
      "id": "google",
      "type": "export",
      "name": "Google Sheets",
        "tokenType": "Bearer",
        "expiryDate": 1588552741700
      },
      "documentId": "1FgM_...",
      "template": {
        "documentId": "10fYhPJzABd8KlgAzxtiyFN-L_SebTvM8SaAK_wHk-Fw",
        "sheetTitle": "Template"
      }
    },
  ...
}
yawhide commented 4 years ago

on hold until i figure out what to do about https://github.com/kevinschaich/mintable/issues/70#issuecomment-652395327

yawhide commented 4 years ago

updated to v2.0.0-beta.36 and success!