Extensions/comfyui-gcs-uploader
ComfyUI Extension

comfyui-gcs-uploader

A custom ComfyUI node that uploads generated images directly to Google Cloud Storage and notifies your Supabase database — with zero Supabase Egress cost.

By sumethweer-cmd·Created 5 months ago·Updated 5 months ago· 0
sumethweer-cmd/comfyui-gcs-uploader
Nodes
On cloudLocal install
Stars0
Updated5 months ago
Readme

comfyui-gcs-uploader 🪣

A custom ComfyUI node that uploads generated images directly to Google Cloud Storage and notifies your Supabase database — with zero Supabase Egress cost.

Why?

The default setup routes images through Supabase Edge Function → GCS, costing ~4MB of Egress per image. This node sends images directly from ComfyUI (RunPod) to GCS, then only sends a small URL string to Supabase.

Before: ComfyUI → Supabase Edge Function → GCS   ❌ Egress ~4MB/image
After:  ComfyUI → GCS                             ✅ Egress ~0
                       ↓ (URL only)
                  Supabase DB

Installation

Via ComfyUI Manager (Recommended)

  1. Open ComfyUI → Manager → Install via Git URL
  2. Paste: https://github.com/YOUR_USERNAME/comfyui-gcs-uploader
  3. Restart ComfyUI
  4. Install dependencies: pip install -r requirements.txt

Manual

cd ComfyUI/custom_nodes
git clone https://github.com/YOUR_USERNAME/comfyui-gcs-uploader
pip install -r comfyui-gcs-uploader/requirements.txt

Configuration

Step 1: Create config.json

cp config.json.example config.json

Edit config.json:

{
  "supabase_url": "https://YOUR_PROJECT.supabase.co",
  "supabase_service_role_key": "YOUR_SERVICE_ROLE_KEY"
}

This is the only thing you need to configure locally.
config.json is gitignored — your credentials are safe.

Step 2: Set GCS Credentials in Web Dashboard

  1. Go to your AI Influencer dashboard → Settings → GCS Credentials
  2. Enter: Project ID, Client Email, Private Key, Bucket Name
  3. Save — the node fetches these automatically at runtime from Supabase.

Usage in Workflow

Add the "Upload to GCS 🪣" node after your image generation node:

| Input | Type | Description | |-------|------|-------------| | image | IMAGE | Output from KSampler or VAE Decode | | job_id | STRING | The production_jobs.id from Supabase | | content_item_id | STRING | The content_items.id from Supabase | | image_type | SFW/NSFW | Type of image | | slot_index | INT | Slot number (0, 1, 2...) |

Output: gcs_url — the public GCS URL of the uploaded image.

Passing Job ID via Workflow

Use a "String Literal" or "Load Text" node to inject the job_id and content_item_id.
When your system queues a job, include these values in the ComfyUI prompt payload so the workflow can read them.


How It Works

  1. Fetches GCS credentials from your Supabase system_configs table (set via web dashboard).
  2. Converts the image tensor → PNG bytes.
  3. Uploads directly to GCS: images/{content_item_id}/{image_type}/{job_id}_{slot_index}.png
  4. Notifies Supabase:
    • Inserts record into generated_images table
    • Updates production_jobs.statusCompleted
  5. On failure: marks job as Failed in DB with error message.

License

MIT