brefphp / bref

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

Errors do not appear on cloudwatch logs #1663

Closed Maxlegend87 closed 10 months ago

Maxlegend87 commented 10 months ago

Description: I'm trying bref to make a little PHP application, so far I'm loving it!

But when throwing an error, I can't find the error in the cloudwatch logs:

INIT_START Runtime Version: provided:al2.v24    Runtime Version ARN: arn:aws:lambda:eu-west-1::runtime:81d6fc3f612653d45ec654b442cabc69425b90001d6194d931e501a2c7bc7bb3
--
[Bref] Loaded these environment variables from SSM: DB_PASSWORD, DB_USER
[13-Oct-2023 08:01:38] NOTICE: [pool default] 'user' directive is ignored when FPM is not running as root
[13-Oct-2023 08:01:38] NOTICE: fpm is running, pid 11
[13-Oct-2023 08:01:38] NOTICE: ready to handle connections
START RequestId: 5453c803-9340-4f3e-b47d-1e2757f797e1 Version: $LATEST
END RequestId: 5453c803-9340-4f3e-b47d-1e2757f797e1
REPORT RequestId: 5453c803-9340-4f3e-b47d-1e2757f797e1  Duration: 12.86 ms  Billed Duration: 519 ms Memory Size: 1024 MB    Max Memory Used: 63 MB  Init Duration: 506.06 ms

And I couldn't find anything to fix it.

How to reproduce:

serverless.yml:

service: app-tpv

provider:
  name: aws
  region: eu-west-1
  environment:
    APP_ENV: 'production'
    DB_USER: bref-ssm:/app-tpv/db-user
    DB_PASSWORD: bref-ssm:/app-tpv/db-password
  runtime: php-82-fpm
  timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
  iam:
    role: arn:aws:iam::*******:role/rolLambda
  vpc:
    securityGroupIds:
      - sg-078d40cdc3873b8af
    subnetIds:
      - subnet-02a3987de4b3d90ac
      - subnet-0405f5e6b445a27ac
      - subnet-045a89a1ef12a9e32

plugins:
  - ./vendor/bref/bref

functions:
  lmbAppTpv:
    handler: src/index.php
    events:
      - httpApi: "GET /"

# Exclude files from deployment
package:
  patterns:
    - "!node_modules/**"
    - "!tests/**"

composer.json:

{
    "require": {
        "bref/bref": "^2.1",
        "bref/secrets-loader": "^1.1"
    }
}

src/index.php:

<?php
throw new Exception('Division by zero.');
echo "Hello";
?>