Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bref-extra:oci8-php-80 doesn't work #323

Open
benzoh opened this issue Feb 15, 2022 · 10 comments
Open

bref-extra:oci8-php-80 doesn't work #323

benzoh opened this issue Feb 15, 2022 · 10 comments

Comments

@benzoh
Copy link

benzoh commented Feb 15, 2022

Hello. Let me ask you a question.
I think I've defined the extension correctly, but it doesn't work.

↓ serverless.yml

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}
            - ${bref-extra:oci8-php-80}
        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
    - ./vendor/bref/extra-php-extensions

image

image

image

Do I need to set anything else?

@Nyholm
Copy link
Collaborator

Nyholm commented Feb 16, 2022

It all looks correct. You should probably also add oci8 layer in your artisan function.

What version of bref/extra-php-extensions are you running? Looking at your second screenshot , the "compatible runtimes" seams weird.

Btw, the layer is verified with: https://github.com/brefphp/extra-php-extensions/blob/master/layers/oci8/test.php

@benzoh
Copy link
Author

benzoh commented Feb 17, 2022

Thank you for your reply.

But I can't increase the runtime version of the extension.

Isn't it necessary to set the parameter here to PROVIDED_AL_2?

image

image

@Nyholm
Copy link
Collaborator

Nyholm commented Jun 21, 2022

FYI: This layer was just updated by @Nemo64

@Nemo64
Copy link
Contributor

Nemo64 commented Jun 21, 2022

I didn't touch the oci8 layer, I modified the odbc-snowflake layer.

@Nyholm
Copy link
Collaborator

Nyholm commented Jun 21, 2022

Oh, Im confused.

Sorry for the ping

@renanwilliam
Copy link

I have the same issue, did you solve it @benzoh ?

@benzoh
Copy link
Author

benzoh commented Aug 22, 2022

@renanwilliam yes. I solved it by defining the layers myself. Please have a look.

serverless.yml looks like this.

functions:
  app:
    handler: public/index.php
    layers:
      - ${bref:layer.php-80-fpm}
      - arn:aws:lambda:ap-northeast-1:XXXXXXXXXXXX:layer:lambda-oci8-layer:3
    events:
      - http:
          path: api/hoge
          method: GET

@renanwilliam
Copy link

Strange, your Dockerfile looks like the same in the official repo. Is there something relevant different that I was not seeing?

@benzoh
Copy link
Author

benzoh commented Aug 23, 2022

I think the solution is to publish with the PROVIDED_AL_2 runtime. I published layer with --compatible-runtimes provided.al2 options.

aws lambda publish-layer-version \
    --layer-name lambda-oci8-layer \
    --description "My oci8 layer" \
    --license-info "MIT" \
    --zip-file fileb://dest/oci8.zip \
    --compatible-runtimes provided.al2 \
    --compatible-architectures x86_64

@karunakapil
Copy link

I am getting this error : 'user' directive is ignored when FPM is not running as root.
Below is my function code in serverless.yml
c-api:
handler: index.php
description: ''
timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds)
layers:
- ${bref:layer.php-80-fpm}
- arn:aws:lambda:us-east-1:553035198032:layer:gcc72-lambda1:4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants