Skip to content
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

Better handling of "insufficient credits" error #121

Closed
soxofaan opened this issue Sep 29, 2023 · 7 comments
Closed

Better handling of "insufficient credits" error #121

soxofaan opened this issue Sep 29, 2023 · 7 comments
Assignees

Comments

@soxofaan
Copy link
Member

reported by @clausmichele when he hit the credits limit:

OpenEoApiError: [500] Internal: Server error: OpenEoApiError('[402] unknown: You do not have sufficient credits to perform this request. Please visit https://portal.terrascope.be/pages/pricing to find more information on how to buy additional credits.') (ref: r-7b93767ec8ee47b5a1c69feaf2512687)

The user get a [500] Internal: Server error from the aggregator, but this is actually a client error (see the inner 402 code).
The aggregator should not change this to a 5xx code

@soxofaan
Copy link
Member Author

I just tried to trigger the "insufficient credits" problem with a test account, but there seems to be an issue so that the error is not raised. So at the moment I can not reproduce it

@soxofaan
Copy link
Member Author

Issue is resolved now, and the insufficient credits error still has this (non-compliant) format (missing "code" field):

HTTP status 402
body {"message":"You do not have sufficient credits to perform this request. Please visit https://portal.terrascope.be/pages/pricing to find more information on how to buy additional credits."}

Ideally a "code" field is added there
but we can start with handling status 402 Payment Required

@JanssenBrm
Copy link

Unless I'm mistaken, this needs to be fixed in the plugin that executes the credit check. From the accounting perspective, we only send execution: false as a 200 OK response.

@soxofaan
Copy link
Member Author

indeed, that's what I made https://github.com/eu-cdse/openeo-cdse-infra/issues/124 for

@soxofaan
Copy link
Member Author

soxofaan commented May 2, 2024

I decided to just pass through the original (openEO compliant) errors from upstream (on sync and batch processing), instead of wrapping everything automatically in a generic "500 Internal error"

Final part to fix the original issue here is to actually have openEO compliant error payload on "insufficient credits" event -> https://github.com/eu-cdse/openeo-cdse-infra/issues/124

@JeroenVerstraelen
Copy link
Contributor

@soxofaan is this still blocked?

@soxofaan
Copy link
Member Author

The aggregator part was not really blocked, I was just waiting for https://github.com/eu-cdse/openeo-cdse-infra/issues/124 to finally close this ticket, which can be done now indeed

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

No branches or pull requests

3 participants