Problem with layer when using serverless-offline with Bref

633 Views Asked by At

I'm trying to run a Symfony application with Bref and serverless-offline. I know that Bref doesn't officially support serverless-offline, but I want to give it a shot; this thread - https://github.com/brefphp/bref/issues/875 - implies that it should be possible but I'm not getting the error described there yet.

When I run sls invoke local -f MyLambda I get this error:

{"errorType":"exitError","errorMessage":"RequestId: 09256631-dcc7-1775-350e-b0c10a2c9c00 Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap]"}

So I assume that serverless-offline fails to get the layer correctly. The directory .serverless/layers contains a sub-structure php-81-fpm/18 for the PHP layer but it is empty.

What's important is that I'm running this setup in a development Docker container. I mounted the docker socket so the Docker daemon on the host is used.

The serverless.yml looks like this (simplified):

plugins:
    - ./vendor/bref/bref
    - serverless-offline

functions:
    MyLambda:
        handler: public/index.php
        layers:
            - ${bref:layer.php-81-fpm} # also tried with 'arn:aws:lambda:eu-central-1:209497400698:layer:php-81-fpm:18'

custom:
    serverless-offline:
        host: 0.0.0.0
        useDocker: true
        dockerHost: host.docker.internal

I'm happy to provide further information, please let me know. Don't hesitate to suggest "low-level" things as I'm quite new to this ecosystem. Thanks for your help!

0

There are 0 best solutions below