Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • A Ahad Mobile
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • holatech
  • Ahad Mobile
  • Merge requests
  • !158

fix(kyc): resolve server 500 when admin repeatedly clicks override to completed

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Hung Hoang requested to merge hunghoang/fix/admin-kyc-override-repeat into develop Oct 31, 2026
  • Overview 0
  • Commits 3
  • Pipelines 2
  • Changes 3

Summary

Fixes an issue where repeatedly clicking "Override to completed" for a user in the Admin console causes an internal server error (HTTP 500).

  • Lark bug: https://hola-tech.sg.larksuite.com/record/OR1TrnU9Be9Fhwc6rFqlbcOrghg
  • Priority: High
  • Module: [Admin] Users & KYC

Root Cause

  1. AdminActionLog JSON Transformer Bug: admin-action-log.entity.ts declared @Column({ type: 'json', nullable: true, transformer: new ColumnJsonTransformer() }) details: Record<string, unknown> | null;. Because PostgreSQL driver node-pg already natively deserializes JSON columns into JavaScript objects on read, ColumnJsonTransformer.from() received an object. When it called JSON.parse(), it failed with a SyntaxError and fell back into its catch block (value.split(',')). Calling .split() on an object caused a fatal TypeError: value.split is not a function. When an admin overrode KYC, an action log entry with non-null details was written. Subsequent reads of user details (AdminUsersService.getUserDetail querying listForTarget) crashed with 500 on every reload or subsequent action.

  2. Sumsub Rate Limits / Intermittent Errors: Repeated clicks to override caused multiple external HTTP requests to Sumsub's getApplicant endpoint, which could fail due to rate limiting or network issues, bubbling up and failing the override flow.

Changes

  1. Entity Fix (be/src/modules/admin/entities/admin-action-log.entity.ts):
    • Removed ColumnJsonTransformer from the native json column details. Node-pg handles serialization and deserialization natively.
  2. KycService Resilience (be/src/modules/kyc/services/kyc.service.ts):
    • Added a try/catch block inside fetchApplicantFields: when Sumsub getApplicant fails due to external rate limiting, log a warning and proceed gracefully using any existing valid document fields in DB.
  3. Tests (be/src/modules/kyc/services/kyc-override-sumsub-failure.spec.ts):
    • Added regression unit test verifying that overrideKycToCompleted succeeds when the user has valid KYC documents, even if Sumsub getApplicant fails due to rate limits.
    • Synchronized with develop incorporating MR !156 (merged)'s validation guards against empty KYC records.

Verification

  • be unit test: pnpm test src/modules/kyc/services/kyc-override-sumsub-failure.spec.ts passed.
  • All KYC unit tests: 78/78 passed.
  • All Admin backend unit tests: 12/12 passed.
  • Admin portal unit tests: 5/5 passed.
  • Production build: pnpm build passed on both be and admin.
Edited Oct 31, 2026 by Hung Hoang
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: hunghoang/fix/admin-kyc-override-repeat