flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Backend] Standardize X-Request-ID header propagation across Express middlewares and error responses

Open blurbeast opened this issue 2 months ago • 8 comments

Overview

Distributed debugging requires tracing a request from client to server logs. Currently, incoming X-Request-ID headers are partially attached in some routes but omitted in error handlers.

Problem

  • When an API error occurs, client cannot report their request ID to support engineers because error responses omit X-Request-ID.

Proposed Changes

  1. Add an early middleware in backend/src/app.ts to assign or preserve req.id = req.headers['x-request-id'] || crypto.randomUUID().
  2. Ensure res.setHeader('X-Request-ID', req.id).
  3. Include requestId in error payloads returned by api-error.ts.

Acceptance Criteria

  • [ ] Every response includes X-Request-ID header.
  • [ ] Error responses include requestId property in JSON body.
  • [ ] Winston logs automatically append requestId.

blurbeast avatar Sep 27 '26 05:09 blurbeast

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

Hi Maintainer, I'd like to help standardize "X-Request-ID" propagation across the FlowFi backend. I can add the early middleware to preserve an incoming request ID or generate one when absent, ensure it is returned on every response, include it in API error payloads, and attach it to Winston logs for consistent request tracing. I’ll also verify the behavior across normal and error responses.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Sam-Adey to this issue.

Sam-Adey avatar Sep 27 '26 14:09 Sam-Adey

@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 removed from the Stellar Wave Program by the repository maintainers.

@Chinko21, you have been unassigned from this issue. If you have any questions, please reach out to the repo maintainers.

drips-wave[bot] avatar Nov 18 '26 16:11 drips-wave[bot]

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

Hello, I’ve carefully reviewed the requirements and believe I can deliver a proper solution that satisfies the acceptance criteria. Please assign it to me.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Hustler490 to this issue.

Hustler490 avatar Nov 21 '26 12:11 Hustler490

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

Hi maintainer, I can get this issue fixed quickly. Please assign it to me

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Raheemah2k26 to this issue.

Raheemah2k26 avatar Nov 21 '26 12:11 Raheemah2k26

Congratulations, @Raheemah2k26! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @Raheemah2k26: 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 Nov 21 '26 12:11 drips-wave[bot]

This issue has been completed by @Raheemah2k26 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @Raheemah2k26: 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. You can also Leave a review to share your experience working on this issue.

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

drips-wave[bot] avatar Nov 21 '26 16:11 drips-wave[bot]