I’m trying to follow the “bref” deployment guide for laravel.
when trying to run “servless deploy” command in the linux terminal, I get the following error:
WebLambdaFunction - Value of property Variables must be an object with String (or simple type) properties."
my serverless.yml file is the follows:
service: laravel
provider:
name: aws
# The AWS region in which to deploy (us-east-1 is the default)
region: us-east-1
# The stage of the application, e.g. dev, production, staging… ('dev' is the default)
stage: dev
runtime: provided.al2
#here
environment:
AWS_BUCKET: # environment variable for Laravel
Ref: Storage
iamRoleStatements:
# Allow Lambda to read and write files in the S3 buckets
- Effect: Allow
Action: s3:*
Resource:
- Fn::GetAtt: Storage.Arn # the storage bucket
- Fn::Join: ['', [Fn::GetAtt: Storage.Arn, '/*']] # everything in the storage bucket
package:
individually: true
# Directories to exclude from deployment
exclude:
- node_modules/**
- public/storage
- resources/assets/**
- storage/**
- venv/**
- tests/**
- .env
- vendor/**
functions:
# This function runs the Laravel website/API
web:
handler: public/index.php
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-74-fpm}
events:
- httpApi: '*'
# This function lets us run artisan commands in Lambda
artisan:
handler: artisan
timeout: 120 # in seconds
layers:
- ${bref:layer.php-74} # PHP
- ${bref:layer.console} # The "console" layer
plugins:
# We need to include the Bref plugin
- ./vendor/bref/bref
resources:
Resources:
Storage:
Type: AWS::S3::Bucket
# The S3 bucket that stores the assets
#taken from here
i suspected the problem is with the following piece:
environment:
AWS_BUCKET: # environment variable for Laravel
Ref: Storage
iamRoleStatements:
# Allow Lambda to read and write files in the S3 buckets
- Effect: Allow
Action: s3:*
Resource:
- Fn::GetAtt: Storage.Arn # the storage bucket
- Fn::Join: ['', [Fn::GetAtt: Storage.Arn, '/*']] # everything in the storage bucket