Skip to content

Instantly share code, notes, and snippets.

@mnapoli
Created October 21, 2022 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnapoli/7c7eab49444637426ce66a24df715a63 to your computer and use it in GitHub Desktop.
Save mnapoli/7c7eab49444637426ce66a24df715a63 to your computer and use it in GitHub Desktop.

This code is not compatible with Bref CDK constructs:

const app = new App();

new MyStack(app, `my-stack-dev`);

Why? Bref automatically set the Bref Lambda layer on your functions. But to do that, Bref needs to know the AWS region to pick the right Bref layer ARN. When you don't set the region explicitly, then Bref cannot access the region (the region variable actually returns the ${AWS:Region} CloudFormation variable, which is useless for Bref).

To fix this, you must set the region explicitly on your stack:

const app = new App();

new MyStack(app, `my-stack-dev`, {
  // 👇 we are explicitly setting the region
  env: {
    region: 'us-east-1',
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment