Update idempotency key when recieving error containing idempotency key #1004

Open
opened 2020-11-11 12:26:49 +00:00 by hj · 0 comments
Owner

In current situation, if you tried to post and got 500 Internal Error, subsequent attempts to post will also result in error. as discussed in irc, we should probably update idempotency key when getting a 5xx error that also has idempotency.

 13:32:04 <@hjkos> just had a weird moment
 13:32:37 <@hjkos> tried to make a post, it errored out, and following attempts at posting would still get errored (500: internal server error) but no error is logged server-side
 13:57:40 <lain_soykaf> hjkos: might be because of the idempotency
 13:57:53 <@hjkos> that's my guess too
 13:58:05 <@hjkos> but it's weird that it gives 500 "internal server error" in that case
 13:58:47 <lain_soykaf> it should return whatever the original call returned
 14:00:05 <@hjkos> sure, but this is incredibly silly
 14:00:43 <@hjkos> it errored out, if i understand logs correctly, because of spontaneous database connection error, not because post is bad or anything like that
 14:01:40 <@hjkos> even if it was because post bad, it would've ideally returned 4xx, not 5xx
 14:02:16 <@hjkos> idempotency shouldn't even work on 5xx errors
 14:07:26 <@hjkos> i seriously wonder if it should be fixed on BE or FE
 14:07:41 <@hjkos> especially when reverse proxies and load balancers are involved
 14:12:46 <@hjkos> should FE update idempotency key when it gets error that has an idempotency key, or?
 14:16:44 <lain_soykaf> yes, i think so.

Important to note that only errors that have idempotency key should do this, since 502 Bad Gateway or similar errors would be coming from reverse proxy, and resetting key would break the idempotency (i.e. post -> timeout -> try again -> bad gateway -> try again -> double post)

In current situation, if you tried to post and got 500 Internal Error, subsequent attempts to post will also result in error. as discussed in irc, we should probably update idempotency key when getting a 5xx error that also has idempotency. ``` 13:32:04 <@hjkos> just had a weird moment 13:32:37 <@hjkos> tried to make a post, it errored out, and following attempts at posting would still get errored (500: internal server error) but no error is logged server-side 13:57:40 <lain_soykaf> hjkos: might be because of the idempotency 13:57:53 <@hjkos> that's my guess too 13:58:05 <@hjkos> but it's weird that it gives 500 "internal server error" in that case 13:58:47 <lain_soykaf> it should return whatever the original call returned 14:00:05 <@hjkos> sure, but this is incredibly silly 14:00:43 <@hjkos> it errored out, if i understand logs correctly, because of spontaneous database connection error, not because post is bad or anything like that 14:01:40 <@hjkos> even if it was because post bad, it would've ideally returned 4xx, not 5xx 14:02:16 <@hjkos> idempotency shouldn't even work on 5xx errors 14:07:26 <@hjkos> i seriously wonder if it should be fixed on BE or FE 14:07:41 <@hjkos> especially when reverse proxies and load balancers are involved 14:12:46 <@hjkos> should FE update idempotency key when it gets error that has an idempotency key, or? 14:16:44 <lain_soykaf> yes, i think so. ``` Important to note that only errors that have idempotency key should do this, since 502 Bad Gateway or similar errors would be coming from reverse proxy, and resetting key would break the idempotency (i.e. post -> timeout -> try again -> bad gateway -> try again -> double post)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe#1004
No description provided.