checkly / checkly-cli

TS/JS native Monitoring as Code workflow
Apache License 2.0
64 stars 8 forks source link

Fix interactive login #122

Closed ianaya89 closed 2 years ago

ianaya89 commented 2 years ago

The interactive login is broken because permission issues withe GET /next/accounts endpoint:

Login Command Error Output

timnolet@Tims-MacBook-Pro-2 analytics-cdn-proxy % checkly

 ERROR  Invalid Session                                                                                                                                                                                                                                                                                                                                         21:10:42

ℹ Run checkly login or manually set CHECKLY_API_KEY & CHECKLY_ACCOUNT_ID environment variables to setup authentication.                                                                                                                                                                                                                                         21:10:42
timnolet@Tims-MacBook-Pro-2 analytics-cdn-proxy % checkly login
? Do you allow to open the browser to continue with login? Yes

(node:6266) UnhandledPromiseRejectionWarning: Error: Request failed with status code 403
    at createError (/usr/local/lib/node_modules/@checkly/cli/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/local/lib/node_modules/@checkly/cli/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/@checkly/cli/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6266) 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: 2)
ianaya89 commented 2 years ago

The issue is related to our new public API endpoint /next/accounts. We recently added permission policies to this endpoint and something seems to be broken.

The current policy this endpoint has is ALL_READ, which should give access to all of our existing roles. For some reason this is not working as expected, will keep diving on this early tomorrow

ianaya89 commented 2 years ago

The issue was found (and fixed) in our Public API.