fix: use CDN upload to avoid WebSocket timeout#572
Merged
emranemran merged 8 commits intomainfrom Mar 4, 2026
Merged
Conversation
Fixes #545 The hardcoded absolute import 'from pipelines.wan2_1.lora.utils' was causing ModuleNotFoundError when loading LoRA adapters. This module path doesn't exist - it should be 'scope.core.pipelines.wan2_1.lora.utils'. Changed to use relative imports consistent with the rest of the file, and moved the import to the top-level imports block. Signed-off-by: livepeer-robot <[email protected]>
When uploading reference images >2MB in cloud mode, the base64-encoded payload was causing WebSocket connection failures (code 1006) after ~2s. The root cause: Large files (3MB+) become ~4MB+ when base64-encoded, exceeding fal.run WebSocket infrastructure limits. Fix: - Files >2MB: Upload directly to fal CDN via REST API, then pass URL through WebSocket for the cloud runner to fetch - Files <2MB: Keep existing base64 approach (faster, single roundtrip) Server-side (fal_app.py) now handles both: - _base64_content: Decode and forward (existing behavior) - _cdn_url: Download from CDN and forward (new) Fixes WebSocket closure when uploading large reference images. Signed-off-by: livepeer-robot <[email protected]>
Signed-off-by: livepeer-robot <[email protected]>
Signed-off-by: livepeer-robot <[email protected]>
Signed-off-by: Max Holland <[email protected]>
Contributor
🚀 fal.ai Preview Deployment
TestingConnect to this preview deployment by setting the fal endpoint in your client: 🧪 E2E tests will run automatically against this deployment. |
Contributor
✅ E2E Tests passed
Test ArtifactsCheck the workflow run for screenshots. |
emranemran
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When uploading reference images larger than ~3MB in cloud mode, the WebSocket connection fails with code 1006 (abnormal closure) after approximately 2 seconds.
Logs observed:
Root Cause
The upload flow was:
{"_base64_content": "<4MB+ string>", ...}For a 3MB image, this creates a ~4MB+ WebSocket message. The fal.run WebSocket infrastructure appears to have message size limits or processing timeouts that cause connection drops for large payloads.
Solution
https://v3.fal.media/files/...){"_cdn_url": "...", ...}Changes:
cloud_proxy.py: Added_upload_to_fal_cdn()functionfal_app.py: Handle_cdn_urlpayload in addition to_base64_contentTesting