Google Cloud Storage integration for Medusa V2 to be used as a file provider.
This module integrates Google Cloud Storage as a file provider for Medusa v2. It allows you to store, serve, and manage files (such as images, documents, and import/export files) directly in a Google Cloud Storage bucket from your Medusa store.
With this plugin, you can:
This module/plugin is compatible with versions >= 2.4.0 of .
Important:
Your Google Cloud Storage bucket must be created with Access control set to Fine-grained. This is required because:
Do not enable "Enforce public access prevention" on the bucket. This setting must be disabled to allow public files to be accessible when needed.
For more details, see Google Cloud Storage Access Control.
To allow Medusa to access your Google Cloud Storage bucket, you need to create a dedicated service account and generate a JSON key for it. This service account will be used by Medusa to upload, update, delete files, and manage their visibility in your bucket.
Important:
Never commit your service account JSON key to version control. Treat it as a secret.
You will use the contents of this JSON key in your Medusa configuration as shown in the Installation section above.
npm install @igorppbr/medusa-v2-gcp-file-provider
{modules: [{resolve: "@medusajs/medusa/file",options: {providers: [{resolve: "@igorppbr/medusa-v2-gcp-file-provider",options: {debug: true, // Show debug logsbucketName: "medusatest", // The name of the bucket in Google Cloud StorageserviceAccountKey: { // The service account key for Google Cloud Storage"type": "service_account","project_id": "your-project-id","private_key_id": "***************","private_key": "-----BEGIN PRIVATE KEY-----\n***************\n-----END PRIVATE KEY-----\n","client_email": "your-service-account@your-project-id.iam.gserviceaccount.com","client_id": "***************","auth_uri": "https://accounts.google.com/o/oauth2/auth","token_uri": "https://oauth2.googleapis.com/token","auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account@your-project-id.iam.gserviceaccount.com"}},}]}}]}
Note: Replace the credentials above with your own service account key. Never commit your real credentials to version control.
Once configured, Medusa will use Google Cloud Storage for file uploads and downloads. You can control the access level (public/private) for each file as needed.
We welcome contributions to this project! If you have suggestions, improvements, or bug fixes, please follow these steps:
Fork the Repository
Create a personal copy of the repository by forking it on GitHub.
Create a New Branch
Create a new branch for your changes:
git checkout -b my-feature-branch
Make Your Changes
Implement your changes in the codebase.
Test Your Changes
Ensure that your changes work as expected and do not break existing functionality.
Submit a Pull Request
Push your changes to your forked repository and submit a pull request to the main repository.
If you need help or have questions about the Google Cloud Storage Integration, please reach out to us: