# 20230331 Unintended Disbursement Process Kerjaansvc
## Overview
Error 460 on POST /v1/client/disbursement endpoint causing disbursement request processed in Xendit (shown in dashboard) but no record in managing database exist.
## Time and Duration
| Time | Event | Actor |
| -------- | -------- | -------- |
| 16.17 | success with 460 | |
| 16.25 | duplicate | |
| 16.29 | duplicate | |
| 16.33 | duplicate | |
| 16.41 | duplicate | |
| 16.45 | api validation error | |
| 16.46 | duplicate | |
| 17.04 | api validation error | |
| 17.21 | api validation error | |
| 20.28 | duplicate | |
| 20.23 | duplicate | |
## Impact
### Impacted Service / Application
1. Kerjaansvc, disbursement (9 transaction with Rp 152.600.000,- in total, refunded from all agents)
## Root Cause
1. Client closed connection to load balancer while request not yet completed, resulting in HTTP 460 response
2. Since transaction is used in create disbursement endpoint, and transaction only rollback database commits, not Xendit transaction, the result is data loss in kerjaansvc database, while record already recorded in xendit server
3. Xendit process all disbursement request immediately with bank transfer request, which resulting in money disbursed cannot be cancelled.
## Resolution
1. For quick prevention of rolled back submitted xendit data, remove transaction usage temporarly. Note that this action will possibly cause some invalid data inserted to database.
2. Prevent esc key to be used in disbursement creation page
3. Add alert on route change or tab close in disbursement creation page
4. Consider using background process for creating disbursement, to ensure easier retry mechanism and error handling can be easier to handle.
5.
## References
1. [AWS HTTP Error Codes](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html)