Skip to content

feat: add BUCKET_PREFIX support for S3 uploads#191

Open
jpswelch wants to merge 1 commit into
runpod-workers:mainfrom
jpswelch:feature/bucket-prefix
Open

feat: add BUCKET_PREFIX support for S3 uploads#191
jpswelch wants to merge 1 commit into
runpod-workers:mainfrom
jpswelch:feature/bucket-prefix

Conversation

@jpswelch
Copy link
Copy Markdown

@jpswelch jpswelch commented Jan 8, 2026

Motivation

Add support for BUCKET_PREFIX environment variable to allow organizing S3 uploaded files under a custom prefix/folder path.

  • When BUCKET_PREFIX is set: uses upload_file_to_bucket with the prefix (e.g., outputs/comfyui/{job_id}/filename.png)
  • When BUCKET_PREFIX is not set: uses original upload_image for backward compatibility

Issues closed

- Add BUCKET_PREFIX environment variable to organize uploaded files under a custom prefix/folder path in S3
- When BUCKET_PREFIX is set, uses upload_file_to_bucket with prefix (preserves original filename)
- When BUCKET_PREFIX is not set, uses upload_image for backward compatibility (random UUID filename)
- Leading/trailing slashes are automatically stripped from BUCKET_PREFIX
- Update configuration documentation with the new environment variable
@TimPietruskyRunPod
Copy link
Copy Markdown
Contributor

Reviewed alongside the broader bug-triage pass on the repo today. The change itself looks good:

  • Opt-in via env var, fully backward compatible (else branch keeps the existing upload_image call) ✅
  • .strip("/") handles both leading/trailing slashes ✅
  • Documentation update is clear and includes the path format example ✅

One small thing before merge: this repo uses Changesets for release notes (see .changeset/). Could you add a file like .changeset/feat-add-bucket-prefix.md:

---
"worker-comfyui": minor
---

feat: add `BUCKET_PREFIX` env var to organize S3 uploaded files under a custom prefix path. When set, uses `rp_upload.upload_file_to_bucket` and the path becomes `{prefix}/{job_id}/{original_filename}`. When unset, behavior is unchanged.

That way the release workflow picks it up and ships it as a minor bump. Once that's added I'll be happy to merge.

Also FYI — once #223 lands, this PR will get an automatically-built base image tagged worker-comfyui-191:base (or similar) so we can deploy a test endpoint and confirm the upload paths actually work against R2/GCS before merging.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants