Handle file uploads with supabase
Medusa Website | Medusa Repository
- Upload files to
assets/
and private files toprivate/
. - Get file signed url
- Delete file
- Node.js v17 or greater
- A Medusa backend
- Supabase account
- Supabase storage bucket. Set it to public as this plugin handles signed urls but some files need to be public :).
1. Run the following command in the directory of the Medusa backend:
npm install medusa-storage-supabase
2. Set the following environment variables in .env
:
STORAGE_BUCKET_REF=<found in the settings>
STORAGE_SERVICE_KEY=<this is the service role key, not the public>
BUCKET_NAME=<bucket name>
3. In medusa-config.js
add the following at the end of the plugins
array:
const plugins = [
// ...
{
resolve: `medusa-storage-supabase`,
options: {
referenceID: process.env.STORAGE_BUCKET_REF,
serviceKey: process.env.STORAGE_SERVICE_KEY,
bucketName: process.env.BUCKET_NAME,
},
},
];
1. Run the following command in the directory of the Medusa backend to run the backend:
npm start
2. Try to change a product image.