You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current hot reloading configuration mountCode has many limitations (e.g., global config, no layer support). An improved configuration API and documentation could make hot reloading more powerful and easier to use with the Serverless Framework.
mountCode: true is a global option but currently does not support hot-reloading of layers (new feature in LocalStack 2.0).
Hot reloading (currently) only works with at most one layer per function. Hence, if we intend to apply mountCode to layers as well, it fails if there is any function with more than one layer in the serverless.yml
We need to consider the scope of hot reloading because not everyone wants to enable hot reloading globally. Selectively enabling hot reloading for single functions or layers under development would be helpful.
mountCode: true uses the current directory (assumed to be project directory) as default hot reload path or accepts relative paths (e.g., ./functions). This might lead to many unnecessary and slow reloads.
These cases are supported by LocalStack but not by the serverless-localstack plugin.
Possible API
service: myServiceplugins:
- serverless-localstackcustom:
localstack:
# DEPRECATED global config# lambda:# mountCode: truestages:
- localhost: http://127.0.0.1provider:
name: awsregion: us-east-1runtime: python3.9# OPTIONAL provider-scoped config here (would need to think about function vs. layers scope)# https://www.serverless.com/framework/docs/providers/aws/guide/layerslayers:
layerOne:
path: layerOnehotReload: true# https://www.serverless.com/framework/docs/providers/aws/guide/functionsfunctions:
hello:
handler: handler.handlerhotReload: truelayers:
- !RefLayerOneLambdaLayer
Considerations
Hot reloading for layers is configured per layer (rather than per layer usage) and applies to all functions using the layer
LocalStack (currently) support at most one layer in total when using hot reloading for a layer. This makes it difficult to apply hot reloading globally for layers.
Should we consider supporting ZIP files for hot reloading such that we can re-use build steps from tools such as Serverless, Gradle, etc rather than adding extra steps to unzip these archives (Java Gradle example).
Another user story for this would be having both image-based and zip-based lambda functions and we don't want the image-based functions to have the S3Uri etc. fields
The current hot reloading configuration
mountCode
has many limitations (e.g., global config, no layer support). An improved configuration API and documentation could make hot reloading more powerful and easier to use with the Serverless Framework.Related Issues/PRs
Challenges
mountCode: true
is a global option but currently does not support hot-reloading of layers (new feature in LocalStack 2.0).mountCode
is bad terminology because the current implementation does not do any mounting anymore but rather copies ZIP files (https://docs.localstack.cloud/user-guide/tools/lambda-tools/hot-reloading/).hotReload
would be a better namemountCode: true
uses the current directory (assumed to be project directory) as default hot reload path or accepts relative paths (e.g., ./functions). This might lead to many unnecessary and slow reloads.Background
addPropertiesToSchema
to add something likedefineLayerProperties
?! Might need to relax provider schema by allowing additional properties like for functions.patternProperties here https://github.com/serverless/serverless/blob/ed15cb27aee68954c93d875da96274914943ad71/lib/classes/config-schema-handler/index.js#L335User Stories
Enable hot reloading for:
These cases are supported by LocalStack but not by the serverless-localstack plugin.
Possible API
Considerations
Alternatives to create layers with Serverless
Based on https://www.tutorialspoint.com/serverless/serverless_layer_creation.htm
The text was updated successfully, but these errors were encountered: