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

Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap] using bref/bref 2.1.0 #1605

Closed
cedric-r-mycelium opened this issue Aug 3, 2023 · 6 comments · Fixed by #1615
Labels

Comments

@cedric-r-mycelium
Copy link

Description:

i have the error Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap] on my lambda after sls deploy --stage=#env# -- function=#function_name#

How to reproduce:

  1. deploy you stack with multiple function sls deploy --stage=#env#
  2. deploy only one fonction with sls deploy --stage=#env# -- function=#function_name#
  3. run the function and see the error
@mnapoli
Copy link
Member

mnapoli commented Aug 6, 2023

Have you added the Lambda layer (or use the proper PHP runtime) in serverless.yml?

Could you double check what gets deployed in the console?

It looks like someone is off, deploying a single function is something widely used across bref users (including me), either something broke very recently in Serverless Framework or something is wrong on your side. Can you reproduce with an empty project?

@cedric-r-mycelium
Copy link
Author

Yes i have runtime: php-82

I have try to reproduce on empty project but i don't have the probleme on my try. i will search more deep

@t-richard
Copy link
Member

t-richard commented Aug 14, 2023

I ran into this. It was related to the fact my runtime was declared globally. Moving the runtime to the function declaration fixed the issue.

When looking in the console, it was not deployed with the php-82 layer, just the extension layer.

@mnapoli
Copy link
Member

mnapoli commented Aug 14, 2023

oh that's interesting, if you have a reproducible example that would be great, that way we can identify the root problem! (maybe a bug in the JS serverless plugin)

was it with a specific runtime? (console maybe?)

@t-richard
Copy link
Member

Reproduced with a config like this

service: test

provider:
    name: aws
    region: eu-west-1
    stage: dev
    runtime: php-82

plugins:
  - ./vendor/bref/bref
  - ./vendor/bref/extra-php-extensions

functions:
    test:
        handler: index.php
        layers:
            - ${bref-extra:imagick-php-82}

It actually is a bug (or at least behaviour) inside the serverless framework.

When defining the runtime globally, bref sets the php-82 layer globally

bref/index.js

Lines 202 to 209 in 3a4a335

if (this.runtimes.includes(config.provider.runtime || '')) {
config.provider.layers = includeBrefLayers(
config.provider.runtime,
config.provider.layers || [], // make sure it's an array
isArmGlobally,
);
config.provider.runtime = 'provided.al2';
}

Those global layers are ignored by the serverless framework on deploy if you have layers defined at the function level.

See : serverless/serverless#11063

@mnapoli
Copy link
Member

mnapoli commented Aug 14, 2023

Let's go 🙌

Two Bref bugs fixed today, that's awesome!

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

Successfully merging a pull request may close this issue.

3 participants