When working with the serverless framework using the typescript template, a serverless.ts file is generated. I am currently integrating lambda layers with existing functions and encountering a typescript error.
The error message reads: "Type '{ Ref: string; }' is not assignable to type 'AwsLambdaLayers'. Object literal may only specify known properties, and 'Ref' does not exist in type 'AwsArn[]'."
functions: {
main: {
handler: "handler.MainHandler",
timeout: 300,
layers: {
Ref: "PrismaLambdaLayer",
},
},
},
layers: {
prisma: {
path: ".prisma-layer",
description: "Layer for prisma clients",
package: {
patterns: [
"!nodejs/node_modules/@prisma/engines/*",
"!nodejs/node_modules/.prisma/**/libquery_engine-*",
"nodejs/node_modules/.prisma/**/libquery_engine-rhel-openssl-1.0.x.so.node",
"!nodejs/prisma/**",
"nodejs/prisma/*.db",
],
},
},
},
For more information on AWS CloudFormation intrinsic function 'Ref', visit this link