imdigital / magento-serverless-gcp
Add Google Cloud functions to the serverless framework
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 2
Open Issues: 0
Type:magento2-module
Requires
- php: >=8.1
- google/cloud-functions: ^1.0
- grpc/grpc: ^1.38
- imdigital/magento-serverless: ^1.0.3
This package is auto-updated.
Last update: 2025-03-14 22:03:19 UTC
README
Google Cloud Functions for the Magento 2 Serverless Framework
This Magento module will extend the Magento 2 serverless framework module allowing us to use Google Cloud Functions.
Installation
Requirements
- Magento >= 2.4.5-p1
- PHP >= 8.1
- Grpc for PHP
Installing the module and enabling it
To install this module we must run the composer require command requesting its installation:
composer require imdigital/magento-serverless-gcp
Then, enable it by modifying the app/etc/config.php or running the CLI command:
php bin/magento module:enable ImDigital_ServerlessGcp
Serverless function setup
When adding a new serverless function into the serverless_functions database table, we must use gcp as the cloud provider code on the cloud_provider field.
The cloud config field expects a (encrypted) JSON on this format:
{ "region_id": "us-central1", "serviceaccount_key": { "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "client_email": "my-service-account-email", "client_id": "my-client-id", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/my-cert-url", "private_key": "my-private-key", "private_key_id": "my-private-key-id", "project_id": "my-gcp-project-id", "token_uri": "https://oauth2.googleapis.com/token", "type": "service_account" } }
The region_id is the region where the cloud function is hosted. The serviceaccount_key field is a service account that we must create, and then generate a JSON service account key with access to execute the functions.
These are the permissions you must add to your service account in order to be able to execute cloud functions: