Skip to content

Bug: v2 throws an exception if the Google Spreadsheet has a chart sheet #107

@viranch

Description

@viranch

My Google Spreadsheet has a bunch of sheets (tabs at the bottom) that are just dedicated for charts (the ones you get after you insert a new chart in a new dedicated tab/sheet). It was working fine with mintable v1, but after migration to v2.0.1 (and updating the config), running mintable fetch throws this exception:

[...]
2020-09-24T06:41:46.558Z [INFO] Fetched 18 sheets.
2020-09-24T06:41:46.804Z [INFO] Cleared 1 range(s): 'Balances'!A1:F10.
2020-09-24T06:41:47.038Z [INFO] Updated 1 range(s): 'Balances'!A1:F10.
2020-09-24T06:41:47.279Z [INFO] Fetched 18 sheets.
2020-09-24T06:41:47.528Z [INFO] Updated indices for 18 sheets.
2020-09-24T06:41:47.774Z [INFO] Fetched 18 sheets.
(node:89857) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'columnCount' of undefined
    at /usr/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:268:95
    at Array.map (<anonymous>)
    at GoogleIntegration.<anonymous> (/usr/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:236:42)
    at step (/usr/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:33:23)
    at Object.next (/usr/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:14:53)
    at fulfilled (/usr/lib/node_modules/mintable/lib/integrations/google/googleIntegration.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:89857) 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:89857) [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.

Looking at /.../mintable/lib/integrations/google/googleIntegration.js:268, its trying to get sheet.properties.gridProperties.columnCount for a sheet that's not of the typical type GRID but of OBJECT due to it being just a "chart sheet", which doesn't contain the sheet.properties.gridProperties attribute.

This sounds like the google's npm package issue, but wondering if there's a way to handle this in mintable and avoid the buggy code path. Also, I'm marking this issue as a bug because this issue did not happen in v1, so from a user's POV, v2 introduced a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions