Closed xanol closed 4 years ago
Hi @xanol ,
Sorry for the slow response.
Humm I think that the SERVERLESS_ALIAS
thingy was initially created to be used with the serverless-aws-alias plugin since serverless doesn't support aliases natively.
This plugin ignore all the env vars set at the provider level. So you always need to configure the specific variables in the warmup
object.
So this seems like a bug and I need to check it 🙂
Are you using the serverless-aws-alias
plugin? If so, are you declaring it after the warmup plugin? That might solve your issue.
No, we are using serverless-plugin-canary-deployments
. I think it's an incompatibility with the two plugins. Our workaround was to set prewarm: false
, since the lambda should get warmed during the canary period anyway.
I'm doing a canary deployment to a function, but I'm running into an issue warming the correct function alias. If I set
SERVERLESS_ALIAS
at the provider environment level, the env variable does not get set on the warming lambda, so after deployment it warms the$LATEST
version. Even though this is now the same code as the canary version, you still experience cold starts because the API Gateway integration is invoking theLive
version. (or, whatever you name the alias.)If I set
SERVERLESS_ALIAS: Live
in thewarmup
config, it sets the runtime environment of the Lambda correctly, but the warming step fails because there is no canary version of the warming function itself. (Only$LATEST
) So, you get an error like this:ServerlessError: Function not found: arn:aws:lambda:us-east-1:111111111111:function:service-name-warmup-plugin:Live: WarmUp: Error while pre-warming functions
because it's looking for the
Live
version.