flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Guard against BigInt serialization errors in stream JSON response formatting

Open blurbeast opened this issue 2 months ago â€ĸ 3 comments

Overview

Prisma models with BigInt fields (e.g. streamId, depositedAmount, withdrawnAmount) cannot be serialized by standard JSON.stringify() without custom replacers, leading to runtime TypeError: Do not know how to serialize a BigInt.

Problem

  • Endpoints must consistently serialize BigInt values to string representation across all controllers.

Proposed Changes

  1. Create a lightweight serializer helper in backend/src/lib/serialize.ts.
  2. Automatically convert BigInt values to strings in API responses.

Acceptance Criteria

  • [ ] All controllers pass responses through BigInt-safe serializer.
  • [ ] No unhandled Do not know how to serialize a BigInt errors.
  • [ ] Test verifies nested objects and arrays containing BigInts serialize correctly.

blurbeast avatar Sep 27 '26 05:09 blurbeast

@Chinko21 has applied to work on this issue as part of the Stellar Wave Program's 9th wave.

I would like to fix this

â„šī¸ Repo Maintainers: To accept this application, review their application or assign @Chinko21 to this issue.

Chinko21 avatar Sep 27 '26 15:09 Chinko21

Congratulations, @Chinko21! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.

🧑‍đŸ’ģ @Chinko21: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Sep 27 '26 15:09 drips-wave[bot]

This issue has been marked as completed by a Drips Wave moderator for @Chinko21 as part of the Stellar Wave Program's 10th Wave đŸĨŗ

Moderator's reason: [Auto-assessed] The PR is merged (mergedAt 2026-10-09T14:36:08Z) and the issue is closed. The contributor added a robust BigInt-safe JSON serialization middleware and helper along with comprehensive unit tests as requested in the issue.

😎 @Chinko21: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here.

🧑‍đŸ’ģ Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

â„šī¸ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.

drips-wave[bot] avatar Oct 20 '26 07:10 drips-wave[bot]