fix: circular JSON in buyCrypto update response#3750
Closed
TaprootFreak wants to merge 1 commit into
Closed
Conversation
BuyCryptoController.update and manualPassAmlCheck returned the raw BuyCrypto entity loaded with transaction.userData.kycSteps. TypeORM populates the KycStep.userData inverse back-reference, producing a circular object graph that JSON.stringify rejects -> 500 on PUT /v1/buyCrypto/:id. The kycSteps relation is required by the update logic, so reload the entity without the cyclic userData collections for the response.
Member
|
Duplicate of #3748 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PUT /v1/buyCrypto/:id(undPUT /v1/buyCrypto/:id/amlCheck) liefern auf PRD HTTP 500:Ursache
BuyCryptoController.updategibt die roheBuyCrypto-Entity zurück.buyCryptoService.update()lädt sie mittransaction.userData.kycSteps. TypeORM setzt beim Laden die RückreferenzKycStep.userDataauf den Parent → zyklischer Objektgraph →JSON.stringifyinres.json()wirft.manualPassAmlCheckdelegiert anupdate()und ist damit identisch betroffen.Die
kycSteps-Relation kam per #3139 ("fix missing relation triggerVideoIdent") rein — unabhängig von der PostgreSQL-Migration. Es gibt keinen globalenClassSerializerInterceptor, der Zyklen abfangen würde.Fix
kycStepswird für die interne Update-Logik gebraucht, kann also nicht weggelassen werden. Daher lädtupdate()die Entity am Ende für die Response neu — ohne die zyklischenuserData-Collections (kycSteps,users). Die Response-Felder bleiben sonst identisch.Test plan
PUT /v1/buyCrypto/{id}für einen BuyCrypto, dessenuserDataKYC-Steps hat → 200 statt 500PUT /v1/buyCrypto/{id}/amlCheck→ 200, AML-Logik unverändert