brefphp / bref

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

Approached unrecognized configuration variable sources: "bref" #988

Closed Manuelacosta98 closed 3 years ago

Manuelacosta98 commented 3 years ago

Description:

Hello I got and old project using bref, that i am trying to debug for a timeout error, but i encounter another problem runing serverless deploy.

I get this warning: Approached unrecognized configuration variable sources: "bref"

This means bref is no longer working? and any tips on debugging those timeouts ?

Thanks a lot.

How to reproduce:

I get the following logs:

` START RequestId: 7454c877-2396-4643-8512-257d0316a2c6 Version: $LATEST

[05-Aug-2021 00:52:11] NOTICE: fpm is running, pid 9 [05-Aug-2021 00:52:11] NOTICE: ready to handle connections END RequestId: 7454c877-2396-4643-8512-257d0316a2c6 REPORT RequestId: 7454c877-2396-4643-8512-257d0316a2c6 Duration: 28024.51 ms Billed Duration: 28369 ms Memory Size: 1024 MB Max Memory Used: 117 MB Init Duration: 344.38 ms 2021-08-05T00:52:39.511Z 7454c877-2396-4643-8512-257d0316a2c6 Task timed out after 28.02 seconds [05-Aug-2021 00:52:39] NOTICE: fpm is running, pid 10 [05-Aug-2021 00:52:39] NOTICE: ready to handle connections START RequestId: 3aa7b6c1-552e-4be9-87a6-abe4e9fa03d3 Version: $LATEST`

service: x

provider:
  name: aws
  region: us-west-2
  runtime: provided
  environment:
    # Symfony environment variables
    DATABASE_URL: ${ssm:x-db-${opt:stage_database, 'prod'}}
  vpc:
    securityGroupIds:
      - sg-12345678
    subnetIds:
      - subnet-1234567

plugins:
  - ./vendor/bref/bref
  - serverless-dotenv-plugin

package:
  exclude:
    - node_modules/**
    - tests/**
    - .idea/**

functions:
  website:
    handler: public/index.php
    timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
    layers:
      - ${bref:layer.php-73-fpm}
    events:
      - http:
          path: '/secure-recruiter/recruiter/address'
          method: put
          cors:
            origin: '*'
            headers:
              - Content-Type
              - X-Amz-Date
              - Authorization
              - X-Api-Key
              - X-Amz-Security-Token
              - X-Amz-User-Agent
            allowCredentials: true
  console:
    handler: bin/console
    timeout: 120 # in seconds
    layers:
      - ${bref:layer.php-73} # PHP
      - ${bref:layer.console} # The "console" layer

node: v16.6.1 Serverless: Framework Core: 2.53.0 Plugin: 5.4.3 SDK: 4.2.6 Components: 3.14.2

t-richard commented 3 years ago

@Manuelacosta98 hi. This error is related to a breaking change in serverless framework.

Updating bref to 1.2.4 or higher should fix the issue.

See https://github.com/brefphp/bref/pull/909

mnapoli commented 3 years ago

πŸ‘ indeed unfortunately you will need to upgrade Bref.

Closing, let's reopen if there's any extra issue.

Manuelacosta98 commented 3 years ago

Hi thanks a lot @t-richard @mnapoli , to see if I get it right, I need to update bref in composer, but still can use the php 7.3 layer?

I will post again when I have tried.

t-richard commented 3 years ago

@Manuelacosta98 yes, you need to update bref (composer update bref/bref) and php 7.3 is still supported in the latest version of bref.

Manuelacosta98 commented 3 years ago

Hi, Thanks to all, the problem was in the networking of the stack so no change in the code was needed.

nat-alana

Someone just delete the nat that was using the lambda to get internet access inside the vpc πŸ‘