From aa1ef201728ee0232a27ac806ad8bc7b430d3169 Mon Sep 17 00:00:00 2001 From: 420coupe <35115310+420coupe@users.noreply.github.com> Date: Fri, 23 Aug 2024 07:10:58 -0400 Subject: [PATCH] docs: update to include Supabase S3 File Provider (#8715) update to include instructions for Supabase S3 Storage Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com> --- .../architectural-modules/file/s3/page.mdx | 55 +++++++++++++++++-- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/www/apps/resources/app/architectural-modules/file/s3/page.mdx b/www/apps/resources/app/architectural-modules/file/s3/page.mdx index de685e2c8f..126c1e3472 100644 --- a/www/apps/resources/app/architectural-modules/file/s3/page.mdx +++ b/www/apps/resources/app/architectural-modules/file/s3/page.mdx @@ -1,4 +1,5 @@ import S3BucketAcl from "../../../troubleshooting/_sections/s3/aws-bucket-acl.mdx" + import { Table, Tabs, TabsList, TabsContent, TabsContentWrapper, TabsTrigger, DetailsList } from "docs-ui" export const metadata = { @@ -18,6 +19,7 @@ The S3 File Module Provider integrates Amazon S3 and services following a compat AWS S3 MinIO DigitalOcean Spaces + Supabase S3 Storage @@ -82,6 +84,18 @@ The S3 File Module Provider integrates Amazon S3 and services following a compat - Create [DigitalOcean Spaces bucket](https://docs.digitalocean.com/products/spaces/how-to/create/). - Create [DigitalOcean Spaces access and secret access keys](https://docs.digitalocean.com/products/spaces/how-to/manage-access/#access-keys). + + + + - [Supabase account](https://supabase.com/dashboard/sign-in) with a project. + - Create [New Public S3 bucket](https://supabase.com/docs/guides/storage/buckets/creating-buckets?queryGroups=language&language=dashboard). + - Create [New S3 Access Keys](https://supabase.com/docs/guides/storage/s3/authentication?queryGroups=language&language=javascript#s3-access-keys). + - Create [Storage Policy](https://supabase.com/docs/guides/storage/security/access-control). + 1. On your bucket's dashboard, click on Policies under the Configuration sidebar. + 2. Click on New Policy under "Other policies under storage.objects". + 3. Click get started quickly, choose "insert access for authenticated users only", and click the "Use this template" button. + 4. Click ALL for "Allowed Operations", click the "Review" button, then the "Save policy" button. + @@ -96,12 +110,6 @@ To install the S3 File Module Provider, run the following command in the directo npm install @medusajs/file-s3@preview ``` - - -Make sure that the version added in `package.json` is `preview` to avoid errors with installation and updates in the future. - - - Next, add the module into the `providers` array of the File Module: @@ -167,6 +175,7 @@ module.exports = { - For AWS S3, the endpoint is of the format `https://{bucket}.s3.{region}.amazonaws.com` - For MinIO, it's the URL to the MinIO server with the bucket's name. For example, `https://{server-domain}/{bucket}`. - For DigitalOcean Spaces, it's either the Origin Endpoint or the CDN endpoint of your Spaces Object Storage bucket. + - for Supabase, it's `https://{uniqueID}.supabase.co/storage/v1/object/public/{bucket}`. You can retrieve the `uniqueID` from [Storage Settings](https://supabase.com/docs/guides/storage/s3/authentication?queryGroups=language&language=javascript#s3-access-keys) page in the Endpoint URL. @@ -258,6 +267,7 @@ module.exports = { - For AWS S3, the endpoint is of the format `https://s3.{region}.amazonaws.com` - For MinIO, it's the URL to the MinIO server. - For DigitalOcean Spaces, it's the Spaces Origin Endpoint. + - For Supabase, it's the Endpoint URL in the [Storage Settings](https://supabase.com/docs/guides/storage/s3/authentication?queryGroups=language&language=javascript#s3-access-keys). @@ -339,6 +349,39 @@ module.exports = { +## Additional Configuration for MinIO and Supabase + +If you're using MinIO or Supabase, set `forcePathStyle` to `true` in the `additional_client_config` object. + +For example: + +```js title="medusa-config.js" +module.exports = defineConfig({ + // ... + modules: { + [Modules.FILE]: { + resolve: "@medusajs/file", + options: { + providers: [ + { + resolve: "@medusajs/file-s3", + id: "s3", + options: { + // ... + additional_client_config: { + forcePathStyle: true, + }, + }, + }, + ], + }, + }, + } +}) +``` +--- + + ## Troubleshooting