brefphp / bref

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

Database connection error PostgessDB #666

Closed GORAZIZYAN98 closed 4 years ago

GORAZIZYAN98 commented 4 years ago

Hi, guys, I have an issue with database cannot migrate database DB is Postgres the severless'yml

service: truescape-game-api provider: name: aws region: eu-central-1 runtime: provided environment: APP_STORAGE: '/tmp' APP_ENV: test APP_DEBUG: true # set to false when moving to production LOG_CHANNEL: stderr # this will send logs to CloudWatch automatically DB_CONNECTION: pgsql DB_HOST: PIPELINES_DB_HOST DB_PORT: 5432 DB_DATABASE: PIPELINES_DB_DATABASE DB_USERNAME: PIPELINES_DB_USERNAME DB_PASSWORD: PIPELINES_DB_PASSWORD vpc: securityGroupIds:

  • sg-xxxxx subnetIds:
  • subnet-xxxx

plugins:

  • ./vendor/bref/bref package: exclude:
    • resources/lang/**
    • storage/**
    • node_modules/**
    • tests/** functions: website: handler: public/index.php timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds) layers:
      • ${bref:layer.php-74-fpm} events:
      • http: 'ANY /'
      • http: 'ANY /{proxy+}' artisan: handler: artisan timeout: 120 # in seconds layers:
      • ${bref:layer.php-74-fpm}
      • ${bref:layer.console}

I have file in root. php/conf.d/php.ini -> ;extension=/opt/bref-extra/pgsql.so extension=pdo_pgsql

when run this command in bitbucket pipelines
vendor/bin/bref cli truescape-game-api-dev-artisan -- migrate --force I got error could not find driver (SQL: select * from information_schema.tables where t able_schema = public and table_name = migrations and table_type = 'BASE TAB LE') In Connector.php line 70: could not find driver

and when I run just php artisan migrate I got timeout error

P.S. all other artisan commands works but migration

victormacko commented 4 years ago

I'm not familiar with Postgres -- but the information_schema.tables is a MySQL one ... maybe check the environment vars are setup to use your postgres DB ... maybe your app is trying to connect to a MySQL DB?

GORAZIZYAN98 commented 4 years ago

@victormacko I cat the .env all vars are there

victormacko commented 4 years ago

Dunno then ... maybe someone else has another idea ... you can always try the slack channel (see the 'community' page on the bref.sh site) for support too

GORAZIZYAN98 commented 4 years ago

yes thanks

mnapoli commented 4 years ago

when run this command in bitbucket pipelines

This is related to BitBucket though.

and when I run just php artisan migrate

Where are you running this?

GORAZIZYAN98 commented 4 years ago

both vendor/bin/bref cli truescape-game-api-dev-artisan -- migrate --force and php artisan migrate --force I run in piplines

mnapoli commented 4 years ago

In the artisan function, you used the ${bref:layer.php-74-fpm} layer: it should be ${bref:layer.php-74}.

GORAZIZYAN98 commented 4 years ago

oh ! @mnapoli thx very much!