Comfy-Org / Comfy-Org/ComfyUI_frontend
fix: parse response body in uploadFileToPresignedUrl error handling (comfyHubService)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
The `uploadFileToPresignedUrl` function in `src/platform/workflow/sharing/services/comfyHubService.ts` currently throws a generic `Error('Failed to upload file')` on non-OK PUT responses. Unlike `getMyProfile()` and `createProfile()` in the same file, it does not use the existing `parseErrorMessage()` utility to extract actionable error details from the response body.
When S3 (or another presigned URL provider) rejects a PUT request — e.g., due to CORS misconfiguration, signature mismatch, or `Content-Type` mismatch — the response body typically contains a structured error message that would help diagnose the issue.
## Proposed Fix
Update `uploadFileToPresignedUrl` to parse the response body via `parseErrorMessage()` and include that in the thrown error, matching the pattern used by the other methods:
```ts
if (!response.ok) {
const message = await parseErrorMessage(response, 'Failed to upload file to presigned URL')
throw new Error(message)
}
```
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10128
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10128#discussion_r2943841285
- Requested by: @christian-byrne
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10465-fix-parse-response-body-in-uploadFileToPresignedUrl-error-handling-comfyHubService-32d6d73d365081f59bc3d906e1e89f78) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.