ComfyUI DriveSend Node
A ComfyUI custom node for seamless Google Drive uploads with optional encryption capabilities. Automatically upload your ComfyUI output files (images and videos) to Google Drive cloud storage.
⚠️ Authentication Methods - READ FIRST
| Method | Lifespan | Best For | Effort |
|---|---|---|---|
| Service Account | ✅ Permanent (never expires) | Cloud/RunPod | Medium setup |
| OAuth 2.0 | ❌ 7 days (must re-auth weekly) | Not recommended | Easy setup |
We strongly recommend Service Account for any persistent use. OAuth tokens expire every 7 days in Google's "testing mode" and there is no workaround without paying for Google Workspace or going through Google's app verification process.
🔄 How It Works
┌─────────────────────────────────────────────────────────────────────────────┐
│ CLOUD (RunPod, etc.) │
│ │
│ ComfyUI generates files ──→ DriveSend Node ──→ Uploads to Google Drive │
│ (png, mp4, etc.) │ │
│ │ │
│ ▼ │
│ ┌──────────────────────┐ │
│ │ Encryption OPTIONAL │ │
│ │ ☐ OFF: file.png │ │
│ │ ☑ ON: file.png.enc │ │
│ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
│
▼
📁 GOOGLE DRIVE
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ YOUR LOCAL MACHINE │
│ │
│ Google Drive syncs/downloads ──→ If encrypted: Run decrypt script (local) │
│ ──→ file.png (viewable!) │
│ │
│ If not encrypted: Ready to use! │
└─────────────────────────────────────────────────────────────────────────────┘
💾 Installation
cd ComfyUI/custom_nodes/
git clone https://github.com/machinepainting/ComfyUI_DriveSendNode.git
cd ComfyUI_DriveSendNode
pip install -r requirements.txt
🔧 Google Cloud Setup (Service Account - Recommended)
Step 1: Create Google Cloud Project
- Go to Google Cloud Console
- Sign in with a personal Gmail account (not work/school - they often have restrictions)
- Click Select a project → New Project
- Name it (e.g.,
ComfyUI-DriveSend) → Create
Step 2: Enable Google Drive API
- Go to APIs & Services → Library
- Search for Google Drive API
- Click Enable
Step 3: Create Service Account
- Go to IAM & Admin → Service Accounts
- Click + Create Service Account
- Name it (e.g.,
comfyui-uploader) - Click Create and Continue
- Skip optional steps → Done
Step 4: Fix Organization Policy (IMPORTANT - New Google Accounts)
Google now blocks service account key creation by default. You MUST disable this policy first.
4a. Grant Yourself Policy Admin Role
- Go to IAM & Admin → IAM
- Click the dropdown at top-left and select your organization (your email domain), not the project
- Click + Grant Access
- Principal: your email
- Role: search for Organization Policy Administrator
- Click Save
4b. Enable the Organization Policy API
Open Cloud Shell (terminal icon at top-right) and run:
gcloud services enable orgpolicy.googleapis.com --project=YOUR_PROJECT_ID
Replace YOUR_PROJECT_ID with your actual project ID.
4c. Disable the Key Creation Restrictions
Run these commands in Cloud Shell:
gcloud org-policies reset iam.disableServiceAccountKeyCreation --project=YOUR_PROJECT_ID
gcloud org-policies reset iam.managed.disableServiceAccountKeyCreation --project=YOUR_PROJECT_ID
Step 5: Create and Download the Key
- Switch back to your project (click dropdown top-left, select your project)
- Go to IAM & Admin → Service Accounts
- Click on your service account
- Go to Keys tab
- Click Add Key → Create new key → JSON → Create
- IMPORTANT: Rename the downloaded file to exactly:
service_account.json
Step 6: Share Your Google Drive Folder
- Go to Google Drive
- Create a new folder (e.g.,
ComfyUI_Uploads) - Right-click the folder → Share
- Open your
service_account.jsonfile and find theclient_emailvalue (looks likename@project-id.iam.gserviceaccount.com) - Paste that email in the Share dialog
- Set permission to Editor
- Click Share (uncheck "Notify people" if prompted)
Step 7: Get Your Folder ID
- Open the folder in Google Drive
- Look at the URL:
https://drive.google.com/drive/folders/XXXXXXXXXXXXXXXXX - Copy the long string after
/folders/— that's your Folder ID
🚀 Local Setup (Quick Test)
- Place
service_account.jsonin theComfyUI_DriveSendNodefolder - Add the DriveSend Setup node to ComfyUI
- Configure:
auth_method: service_accountfolder_id: your folder IDowner_email: your Gmail address (required!)storage_method: env_fileencryption_key_method: off (for testing)
- Run the node
- Add DriveSend AutoUploader node and run a workflow
☁️ RunPod / Cloud Setup (Persistent)
Option A: Custom Template (Recommended - One-Time Setup)
- Run the DriveSend Setup node locally with
storage_method: display_only - Copy the output values from the console
- In RunPod, go to Secrets and create:
| Secret Name | Value |
|---|---|
GOOGLE_DRIVE_FOLDER_ID |
Your folder ID |
GOOGLE_SERVICE_ACCOUNT_JSON |
The base64 string from setup |
GOOGLE_OWNER_EMAIL |
Your Gmail address |
comfyui_encryption_key |
(only if using encryption) |
-
Create or edit a Pod Template:
- Click Edit Template → Environment Variables
- Add each variable, linking to secrets:
- Key:
GOOGLE_DRIVE_FOLDER_ID→ Value:{{ RUNPOD_SECRET_GOOGLE_DRIVE_FOLDER_ID }} - Key:
GOOGLE_SERVICE_ACCOUNT_JSON→ Value:{{ RUNPOD_SECRET_GOOGLE_SERVICE_ACCOUNT_JSON }} - Key:
GOOGLE_OWNER_EMAIL→ Value:{{ RUNPOD_SECRET_GOOGLE_OWNER_EMAIL }} - Key:
comfyui_encryption_key→ Value:{{ RUNPOD_SECRET_comfyui_encryption_key }}
- Key:
- Click Set Overrides
-
Deploy pods using this template — credentials persist automatically!
Option B: Manual Environment Variables (Each Pod)
If you don't want to create a template, manually add the environment variables each time you create a pod. This is more tedious but works the same way.
📋 Node Settings Reference
DriveSend Setup Node
| Field | Description |
|---|---|
auth_method |
service_account (recommended) or oauth |
folder_id |
Google Drive folder ID from URL |
owner_email |
Your Gmail - required for service account! |
storage_method |
display_only (cloud) or env_file (local) |
encryption_key_method |
off, Display Only, or save to .env |
service_account_path |
Default: service_account.json |
DriveSend AutoUploader Node
| Field | Description |
|---|---|
watch_directory |
Folder to monitor (default: ComfyUI output) |
auth_method |
Must match setup node |
folder_id |
Override folder ID (or leave blank to use env var) |
owner_email |
Override owner email (or leave blank to use env var) |
enable_encryption |
Encrypt files before upload |
Post_Delete_Enc |
Delete .enc files after upload |
Subfolder_Monitor |
Watch subfolders too |
run_process |
Start/stop the monitor |
❓ Why is owner_email Required?
Service accounts have 0 GB storage quota. When a service account uploads a file, it owns that file — but it has no storage space!
The owner_email setting transfers ownership to your personal Gmail account after upload, so the file uses YOUR storage quota (15 GB free).
Without this, uploads will fail with: 403 storageQuotaExceeded
🔐 Encryption (Optional)
Enable encryption to protect files in cloud storage:
- In Setup node: set
encryption_key_methodto Display Only or save to .env - In AutoUploader: set
enable_encryptionto True - Save your encryption key securely — you need it to decrypt files!
See the /scripts/ folder for decryption scripts (run on your local machine after downloading).
🛠️ Troubleshooting
"service_account.json NOT FOUND"
- Rename your downloaded key file to exactly
service_account.json - Place it in the
ComfyUI_DriveSendNodefolder
"403 storageQuotaExceeded"
- Set
owner_emailto your Gmail address - Make sure the folder is shared with your service account email
"Organization Policy blocks key creation"
- Follow Step 4 in the setup guide to disable the policy restrictions
- Run the gcloud commands in Cloud Shell
"Permission denied" on upload
- Make sure you shared the Google Drive folder with the service account email
- The service account needs Editor access
📁 Repository Structure
ComfyUI_DriveSendNode/
├── __init__.py
├── drivesend_uploader_node.py
├── drivesend_setup_node.py
├── gdrive_upload.py
├── gdrive_auth_manager.py
├── encrypt_file.py
├── monitor_output.py
├── requirements.txt
├── README.md
├── .gitignore
└── scripts/
├── decrypt_folder.py
├── decrypt_folder_mac.sh
├── encrypt_folder_mac.sh
├── decrypt_folder_win.py
├── encrypt_folder_win.py
├── decrypt_folder_linux.sh
└── encrypt_folder_linux.sh
🧪 Status
Testing in Progress — Based on the working DropSend Node.
Please report issues on GitHub!
License
MIT