storj / gateway-st

Single-tenant, S3-compatible server to interact with the Storj network
Apache License 2.0
71 stars 19 forks source link

Misleading error when hitting rate limiter #50

Closed Erikvv closed 2 years ago

Erikvv commented 2 years ago

Issue reported by filebase. It seems when the satellite rate limit is hit for number of request there is this 403 error:

Error: You have reached your Storj project upload limit on the Satellite. (minio.ErrorResponse)

But it should probably be a 429 error or at least a more appropriate message.

wthorp commented 2 years ago

These are monthly limits. A 429 makes sense but probably shouldn't be accompanied by Retry-after http headers for more temporal rate limiting. Minio, I think, appends a 2 minute retry for its "SlowDown" errors, we should avoid this. Also, it seems that either metainfo projectUsage.ExceedsStorageUsage() or projectUsage.ExceedsBandwidthUsage() both could yield this 403 message. We probably need to fine-tune these errors more if we're going to move to a 429.

amwolff commented 2 years ago

We fixed error mapping in b9f24f92fd6625d6de160663cc4d98063562eb7b.