saintedlama / toggl-client

Client for the Toggl API built for async and await support
ISC License
16 stars 5 forks source link

Disables got retry logic #24

Closed beauraines closed 1 year ago

beauraines commented 1 year ago

Disables retry logic following suggestion from https://github.com/sindresorhus/got/issues/1489 to prevent throw new Error('TheonCancelhandler was attached after the promise settled.')

I've not updated my client to ESM so I'm unable to test this on the latest version, but I've been running this based upon your commit prior to the ESM conversion, 250191a4900912a193dd3b3a24c1f343188bdcfd

This is to prevent this error from occurring

/Users/beauraines/projects/toggl-cli-node/node_modules/p-cancelable/index.js:48
                    throw new Error('The `onCancel` handler was attached after the promise settled.');
                          ^

Error: The `onCancel` handler was attached after the promise settled.
    at onCancel (/Users/beauraines/projects/toggl-cli-node/node_modules/p-cancelable/index.js:48:12)
    at makeRequest (/Users/beauraines/projects/toggl-cli-node/node_modules/got/dist/source/as-promise/index.js:38:13)
    at Request.<anonymous> (/Users/beauraines/projects/toggl-cli-node/node_modules/got/dist/source/as-promise/index.js:143:17)
    at Object.onceWrapper (node:events:628:26)
    at Request.emit (node:events:513:28)
    at Timeout.retry (/Users/beauraines/projects/toggl-cli-node/node_modules/got/dist/source/core/index.js:1278:30)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
beauraines commented 1 year ago

@saintedlama I think that the github actions is missing the TOGGL_API_TOKEN so the CI is failing.

The tests are passing locally

$ npm test

> toggl-client@1.1.0 test
> mocha

  smoke test
    ✓ should list workspaces (163ms)
    ✓ should list projects in a workspace (247ms)
    ✓ should get a details report (303ms)
    ✓ should get a user (131ms)
    - should get a new API token
    ✓ should throw an error if current password not supplied
    ✓ should throw an error if time of day format is invalid
    ✓ should throw an error if date format is invalid
    - should generate time entries

  7 passing (853ms)
  2 pending
saintedlama commented 1 year ago

Will need to fix some stuff today/tomorrow

beauraines commented 1 year ago

Addressed in #28