fix: set success_action_status on S3 presigned POST to fix CORS on Ceph-based providers#7362
fix: set success_action_status on S3 presigned POST to fix CORS on Ceph-based providers#7362BhagyaAmarasinghe merged 1 commit intomainfrom
Conversation
…ph-based providers
WalkthroughThe 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
mattinannt
left a comment
There was a problem hiding this comment.
looks good; thank you for the fix :-)



What does this PR do?
Fixes #7086
success_action_status: "201"to the S3 presigned POST fields so the storage provider returns201 Createdinstead of the default204 No Content204response omits CORS headers, causing the browser to block the response and report upload failure even though the file was successfully written to the bucketRoot Cause
When uploading files via presigned POST, S3-compatible providers default to returning
204 No Content. Ceph/RGW-based providers (like Hetzner Object Storage) do not includeAccess-Control-Allow-Originheaders on204responses, even when CORS is properly configured on the bucket. The browser blocks the response,fetch()throws aTypeError: Failed to fetch, and the app reports "Upload failed" despite the file being successfully stored.Setting
success_action_status: "201"instructs the provider to return201 Createdinstead, which correctly includes CORS headers. This is also the recommended approach in the AWS S3 POST documentation. The change is backward-compatible —Response.okcovers both200-299, so AWS S3, MinIO, and other providers continue to work.How should this be tested?
pnpm test --filter=@formbricks/storage— 64/64 pass)204 No Content→201 CreatedChecklist
Required
pnpm buildconsole.logsgit pull origin mainAppreciated