brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.15k stars 365 forks source link

Error: Runtime exited with error: exit status 255 Runtime.ExitError #1490

Closed bgreatfit closed 1 year ago

bgreatfit commented 1 year ago

Description:

Error: Runtime exited with error: exit status 255 Runtime.ExitError How to reproduce:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  0.4 - Building a serverless Laravel App with AWS SAM and Bref-FPM
##########################################################################
#  Parameters & Globals                                                  #
##########################################################################

##########################################################################
#  Globals                                                               #
##########################################################################
Globals:
  Function:
    Timeout: 3
    Environment:
      Variables:
#        AWS_BUCKET: !Ref Storage
#        AWS_PUBLIC_BUCKET: !Ref Assets

Resources:

  Api:
    Type: AWS::Serverless::HttpApi
    Properties:
      Description: API CORE
      CorsConfiguration: true

  ##########################################################################
#  Lambda function with PHP runtime provided by layers                   #
##########################################################################
  CatchAllLambdaFunctionLaravel:
    Type: AWS::Serverless::Function
    Properties:
      Description: Lambda function to hosts entire application codebase
      CodeUri: .
      Runtime: provided.al2
      Handler: post/public/index.php #follows our Laravel implementation
      MemorySize: 1024
      Timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
      Tracing: Active
      Environment:
        Variables:
          APP_STORAGE: /tmp

      Layers:
        - 'arn:aws:lambda:us-east-1:534081306603:layer:php-82-fpm:21'
      Events:
        DynamicRequestsRoot:
          Type: HttpApi
          Properties:
            Path: /post
            Method: GET
            ApiId: !Ref Api
        DynamicRequestsProxy:
          Type: HttpApi
          Properties:
            Path: /post_test
            Method: GET
            ApiId: !Ref Api

  UserAllLambdaFunctionLaravel:
    Type: AWS::Serverless::Function
    Properties:
      Description: Lambda function to hosts entire application codebase
      CodeUri: .
      Runtime: provided.al2
      Handler: user/public/index.php #follows our Laravel implementation
      MemorySize: 1024
      Timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
      Tracing: Active
      Environment:
        Variables:
          APP_STORAGE: /tmp
          MY_SSM_PARAMETER_RESOLVE: "{{resolve:ssm:/MyParameter:1}}"

      Layers:
        - 'arn:aws:lambda:us-east-1:534081306603:layer:php-82-fpm:21'
      Events:
        DynamicRequestsRoot:
          Type: HttpApi
          Properties:
            Path: /user
            Method: GET
            ApiId: !Ref Api
        DynamicRequestsProxy:
          Type: HttpApi
          Properties:
            Path: /user_test
            Method: GET
            ApiId: !Ref Api
#
# Outputs show up in the CloudFormation dashboard
#Outputs:
#    Website:
#        Description: 'URL of our function in the *Prod* environment'
#        Value: !Sub 'https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/'

Outputs:
  PostEndpoint:
    Description: "Endpoint to create booking event"
    Value: !Sub |
      curl --location --request POST \
      'https://${Api}.execute-api.${AWS::Region}.amazonaws.com/user' \
      --header 'Content-Type: application/json' --data-raw '{"sku": 100}'

this is only a demo project. this error occurs when I do sam deploy and cloud watch reports of the error