Skip to content

[Feature] Implement Async Nano Banana Webhook Processing with Dead-Letter Queue & Polling Fallback #29

Description

@Darkvader-ship-it

Estimated Effort: 2 weeks / 6 days

Impacted Subsystems / Files:

  • app/api/webhooks/nanobanana/route.ts
  • lib/forge-nanobanana.ts
  • lib/server-data-paths.ts

Context & Problem Statement:
When image generation takes longer than Vercel serverless execution limits (10s/60s), the current implementation in lib/forge-nanobanana.ts times out, causing the client to lose payment confirmation context even though the AI engine eventually completes.

Technical Requirements & Scope:

  1. Refactor app/api/webhooks/nanobanana/route.ts to receive async generation callbacks.
  2. Implement persistent job state tracking stored in .data/generation-jobs.json.
  3. Build client polling endpoint allowing frontend to query job status by transaction hash.
  4. Implement dead-letter queue mechanism to record failed webhook callbacks for retry.

Multi-File Change Surface:
Modifies webhook endpoint app/api/webhooks/nanobanana/route.ts, lib/forge-nanobanana.ts, and frontend polling hooks in app/forge/page.tsx.

Acceptance Criteria:

  • Image generation jobs exceeding 60s complete asynchronously without request failure.
  • Webhook signatures verified against NANOBANANA_WEBHOOK_SECRET.
  • Failed jobs automatically recorded in dead-letter store with full error trace.

Suggested Approach / Investigation Steps:

  1. Define async job state schema and webhook signature validator.
  2. Implement store operations in lib/generation-job-store.ts.
  3. Connect client UI to poll generation job status until completed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions