Handle file uploads with vercel
Medusa Website | Medusa Repository
- Upload files to
assets/
(Only Support Public uploads). - Get file signed url
- Delete file
- Node.js v17 or greater
- A Medusa backend
- Vercel Blob Storage Setup
- Vercel storage bucket.
1. Run the following command in the directory of the Medusa backend:
npm install medusa-storage-vercel
2. Set the following environment variables in .env
:
BLOB_READ_WRITE_TOKEN=<vercel_blob_secret_xxxxxxxxxx....>
BUCKET_NAME=<bucket_name>
3. In medusa-config.js
add the following at the end of the plugins
array:
const plugins = [
// ...
{
resolve: `medusa-storage-vercel`,
options: {
blobReadWriteToken: process.env.BLOB_READ_WRITE_TOKEN,
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.