Skip to content

DiscordService has no timeout on its outgoing HTTPS request #242

Description

@meshackyaro

Description

DiscordService.sendWebhook() (src/webhook/discord.service.ts) issues a raw https.request() to the configured DISCORD_WEBHOOK_URL with no timeout configured, mirroring the same gap as WebhookService.send() (see the related issue). Since EscrowController.raiseDispute() and DisputeSagaService.escalate() both await discordService.notifyDisputeNeedsJurors(...) directly in their request path (not fire-and-forget), a hung connection to Discord's webhook endpoint would stall the HTTP response to the client raising the dispute, even though notifyDisputeNeedsJurors() already catches and logs errors rather than propagating them — it just never gets the chance to if the request never settles.

Component

Backend

Difficulty

🟢 Easy

Tasks

  • Add an explicit timeout to the https.request() call in DiscordService.sendWebhook()
  • Add a test using a mock server that never responds, asserting notifyDisputeNeedsJurors() resolves (having logged the failure) within the configured timeout rather than hanging

Acceptance Criteria

  • A hung connection to the Discord webhook endpoint no longer blocks the caller indefinitely
  • A test proves the timeout behavior

Estimated Time

1-2 hours

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions