DEV Community

Discussion on: Managing Lambda Size with Multiple Prisma Clients

Collapse
 
markkos89 profile image
Marcos Iglesias

Hi @sabinthedev ! Thanks in advance for your great article and how your explain things! It's really interesting to read, thanks!!!

May I ask one question regardin the Reference to the Lambda Layer?
your are setting:

layers:
      - { Ref: PrismaLambdaLayer }
Enter fullscreen mode Exit fullscreen mode

But there is no Layer declared with that name, as they are named prisma.
Is this correct?
Or the right way is to Ref to it like to prisma, in this case, for example?

Thanks in advance!!

Regards

Collapse
 
sabinthedev profile image
Sabin Adams

Hey Marcos!

If you look at the section where the layers are defined for the entire service:

layers:
  prisma:
    path: .prisma-layer
    description: 'Layer for Prisma Clients'
    package:
      patterns:
        -< ...patternstuff...>
Enter fullscreen mode Exit fullscreen mode

This creates a layer named prisma. According to the docs here:

To use a layer with a function in the same service, use a CloudFormation Ref. The name of your layer in the CloudFormation template will be your layer name TitleCased (without spaces) and have LambdaLayer appended to the end.

So following that, the layer name would be referenced as PrismaLambdaLayer.

Hope this helps!