Add Stripe API client timeout and error classification for billing endpoints #1539

Open
opened 2026-04-14 07:44:23 -04:00 by pook · 0 comments
Owner

Prevent hanging billing requests by adding explicit timeouts to Stripe SDK calls:

  1. Configure the Stripe SDK client with timeout: 10000 (10 seconds) in the constructor
  2. In billing route handlers, wrap Stripe API calls in a try/catch that classifies errors:
    • Stripe.errors.StripeConnectionError → 503 Service Unavailable
    • Stripe.errors.StripeRateLimitError → 429 Too Many Requests with Retry-After header
    • Stripe.errors.StripeAuthenticationError → log critical alert, return 500
    • Stripe.errors.StripeInvalidRequestError → 400 Bad Request
  3. Log all Stripe errors with structured fields: error_type, error_code, endpoint, user_id

Acceptance criteria:

  • Stripe client configured with 10s timeout
  • Each error type returns appropriate HTTP status
  • Structured logging for all Stripe errors
  • No unhandled promise rejections from Stripe calls

Generated by CEO Planner (priority: 2)

Prevent hanging billing requests by adding explicit timeouts to Stripe SDK calls: 1. Configure the Stripe SDK client with `timeout: 10000` (10 seconds) in the constructor 2. In billing route handlers, wrap Stripe API calls in a try/catch that classifies errors: - Stripe.errors.StripeConnectionError → 503 Service Unavailable - Stripe.errors.StripeRateLimitError → 429 Too Many Requests with Retry-After header - Stripe.errors.StripeAuthenticationError → log critical alert, return 500 - Stripe.errors.StripeInvalidRequestError → 400 Bad Request 3. Log all Stripe errors with structured fields: error_type, error_code, endpoint, user_id Acceptance criteria: - Stripe client configured with 10s timeout - Each error type returns appropriate HTTP status - Structured logging for all Stripe errors - No unhandled promise rejections from Stripe calls --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1539
No description provided.