Skip to content

fix(checkins): read error message from response body #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

subzero10
Copy link
Member

@subzero10 subzero10 commented Jan 7, 2025

Status

READY

Description

Fixes #223.
Read error messages from response body instead of relying only on the HTTP status code.

This should handle the cases where a more specific message is included in the response body.
For example, we would show a generic The API key provided is invalid. when receiving a 403, but there are cases where the message could be:

  • either You need to upgrade your plan to get cron support.
  • or You have reached your plan's limit for the number of check-ins.

@subzero10 subzero10 self-assigned this Jan 7, 2025
@subzero10 subzero10 requested a review from stympy January 7, 2025 08:36
@subzero10
Copy link
Member Author

@stympy I am facing another issue here and I'd like your input on how to go about it:
I'm getting 429 errors if I create checkins in a for loop:

php artisan honeybadger:checkins:sync
string(29) "08:38:06: fetching project id"
string(46) "08:38:07: fetching check-ins for project 68958"
string(54) "08:38:07: creating check-in sync-all for project 68958"
string(58) "08:38:08: creating check-in check-uptime for project 68958"
[2025-01-07 08:38:08] local.ERROR: You have hit your exception rate limit. {"exception":"[object] (Honeybadger\\Exceptions\\ServiceException(code: 0): You have hit your exception rate limit

I verified that if I wait 1 second (sleep(1)), I don't get the error.
Could this be because the personal API token is stricter in terms of rate limitations?

Also, when I first implemented this feature I wouldn't get this error, and I remember specifically creating the maximum number of checkins allowed in my account (5). Now I get the error at the moment it tries to create the second one.

@subzero10 subzero10 merged commit f6fd084 into master Jan 7, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect error reason when syncing check-ins
2 participants