Does GCP / Cloud Functions have a library concept anything like AWS Lambda Layers? Meaning, if we wanted to reduce code duplication and roll out a common library layer for our Google Cloud Functions, how would we do it?
Does GCP / Cloud Functions have a library concept anything like AWS Lambda Layers? Meaning, if we wanted to reduce code duplication and roll out a common library layer for our Google Cloud Functions, how would we do it?
No, you haven't this kind of feature with Cloud Function. I have 3 immediate alternatives in mind
Project tree
root
|
- Common
|
- Functions
|
- function A
|
- function B
In function A and function B you use the common file in the Common directory. When you deploy your function, do it in the root directory and use the source directory to indicate in which directory to look for the function to deploy
gcloud functions deploy --source=function/functionA ...
Trade Off