Title: [BUG] Direct uploads fail with S3_ENDPOINT (non-AWS): metadata dropped from presigned query, CSP blocks endpoint · Issue #8378 · simstudioai/sim · GitHub
Open Graph Title: [BUG] Direct uploads fail with S3_ENDPOINT (non-AWS): metadata dropped from presigned query, CSP blocks endpoint · Issue #8378 · simstudioai/sim
X Title: [BUG] Direct uploads fail with S3_ENDPOINT (non-AWS): metadata dropped from presigned query, CSP blocks endpoint · Issue #8378 · simstudioai/sim
Description: Describe the bug With S3_ENDPOINT pointing at a non-AWS S3-compatible store, direct browser uploads fail. This covers knowledge base documents, workspace files, profile pictures and attachments. There are two independent causes. Upload m...
Open Graph Description: Describe the bug With S3_ENDPOINT pointing at a non-AWS S3-compatible store, direct browser uploads fail. This covers knowledge base documents, workspace files, profile pictures and attachments. Th...
X Description: Describe the bug With S3_ENDPOINT pointing at a non-AWS S3-compatible store, direct browser uploads fail. This covers knowledge base documents, workspace files, profile pictures and attachments. Th...
Opengraph URL: https://github.com/simstudioai/sim/issues/8378
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] Direct uploads fail with S3_ENDPOINT (non-AWS): metadata dropped from presigned query, CSP blocks endpoint","articleBody":"**Describe the bug**\n\nWith `S3_ENDPOINT` pointing at a non-AWS S3-compatible store, direct browser uploads fail. This covers knowledge base documents, workspace files, profile pictures and attachments. There are two independent causes.\n\n1. **Upload metadata is lost.** `getS3PresignedUploadUrl` (`apps/sim/lib/uploads/providers/s3/client.ts`) lets the AWS presigner hoist `x-amz-meta-*` into the query string. AWS S3 stores query-string metadata. Other S3 implementations don't, including OVHcloud Object Storage. The object lands without metadata, and `headProviderObject` (`apps/sim/lib/uploads/upload-session/provider.ts`) throws `Upload object \u003ckey> is missing required provider metadata`, so `/documents/uploads/\u003cid>/complete` returns 500.\n2. **CSP blocks the PUT.** `connect-src` (`apps/sim/lib/core/security/csp.ts`) only allows `*.amazonaws.com` and a few other fixed hosts. It never includes the `S3_ENDPOINT` host, so the browser refuses the presigned PUT before it is sent.\n\n**To Reproduce**\n\n1. Self-host with `STORAGE_PROVIDER=s3`, `S3_ENDPOINT=https://s3.de.io.cloud.ovh.net`, `AWS_REGION=de`, bucket CORS allowing PUT from the app origin. Reproduced on v0.8.41 and current `main`.\n2. Upload a document to a knowledge base.\n3. The browser console shows a CSP `connect-src` violation for `https://\u003cbucket>.s3.de.io.cloud.ovh.net/...`.\n4. With the CSP worked around, the PUT succeeds (200), but `complete` fails with \"missing required provider metadata\". `HeadObject` on the uploaded key returns `Metadata: {}`.\n\n**Expected behavior**\n\nUploads work against any S3-compatible endpoint configured via `S3_ENDPOINT`.\n\n**Additional context**\n\nI tested against the real OVH bucket with `@aws-sdk/s3-request-presigner`:\n\n| Presign mode | PUT | `HeadObject().Metadata` |\n|---|---|---|\n| default (metadata hoisted into query) | 200 | `{}` |\n| `unhoistableHeaders: new Set(['x-amz-meta-…'])` and the same headers sent by the client | 200 | `{\"uploadid\":\"abc123\"}` |\n\nA possible fix:\n\n- When `S3_ENDPOINT` is set, presign with the metadata keys as `unhoistableHeaders` and return them in `headers` so the client sends them. They are then signed, which AWS accepts too. Bucket CORS must allow these headers (`AllowedHeaders: *`).\n- Add the origin of the `S3_ENDPOINT` bucket host (virtual-hosted or path-style) to `connect-src` in both build-time and runtime CSP.\n\nHappy to open a PR.\n","author":{"url":"https://github.com/schalterDev","@type":"Person","name":"schalterDev"},"datePublished":"2026-09-28T17:33:25Z","url":"https://github.com/simstudioai/sim/issues/8378"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0974c341-4260-ada8-7481-8a6ed9bec09b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE48:2F4711:3E97E2:58092C:6AFB597D |
| html-safe-nonce | 8304c0dfd16923d914197ce427ca8a1391e84a0882ad2598331b98e32e771de1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTQ4OjJGNDcxMTozRTk3RTI6NTgwOTJDOjZBRkI1OTdEIiwidmlzaXRvcl9pZCI6Ijg3NDMxNjQ0NTQwOTIxMDIwMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | dc76cb4a7067b891e58106bc5f23f35dad26b5a0df1c44b7afe88884ed43ebae |
| hovercard-subject-tag | issue:5618695890 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/simstudioai/sim/8378/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d22805b8903a10edcd6507af2931ca09268c1d14f359d1254905d38b1b8dbf15/simstudioai/sim/issues/8378 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d22805b8903a10edcd6507af2931ca09268c1d14f359d1254905d38b1b8dbf15/simstudioai/sim/issues/8378 |
| og:image:alt | Describe the bug With S3_ENDPOINT pointing at a non-AWS S3-compatible store, direct browser uploads fail. This covers knowledge base documents, workspace files, profile pictures and attachments. Th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | schalterDev |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width