question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lambda with alias does not get triggered as intended

See original GitHub issue

Hello - This is a nifty plugin, thanks for that!

What

I have recently configured this plugin on my lambda which uses an alias to point at the latest deployed version. I would like to have the warmup plugin keep the lambda function version warm which was configured behind that alias (at any given time).

How it’s implemented?

  1. My lambda is deployed and latest deployment is pointing to an alias :live

  2. Here is the warmup settings in serverless.yml

custom:
  warmup:
    events:
      - schedule: cron(0/5 8-18 ? * MON-FRI *)
    name: lambda-warmer
    concurrency: 1
    prewarm: true
    vpc: false

functions:
  <function-name>:
    warmup:
      name: <function's logical name>:live
      enabled: true

Behaviour Observed

  • Warmup plugin is doing its job finely, so I can see a dedicated CloudWatch log group is updating every 5 mins with the warmup call logs.
  • However, when the real client application invokes the same lambda (with alias :live), AWS does not want to reuse the warmed-up container of that lambda instead it is creating a new lambda container (new CloudWatch log group) hindering the very basic premise of pre-warming it.

Please suggest.

Cheers, ram

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
juanjoDiazcommented, Jan 11, 2021

The name prop is only usable in the service level and it’s the name given to the actual warmer function, not the name of the function to warm up.

The solution, I just realized, is not documented. It uses the You can pass the alias to warmup using the environment variable SERVERLESS_ALIAS. The warmer will use that alias for all the functions to warm up. If you want different aliases for different functions, you need to wait for version 5 which supports multiple warmers.

custom:
  warmup:
    events:
      - schedule: cron(0/5 8-18 ? * MON-FRI *)
    concurrency: 1
    prewarm: true
    vpc: false
    environment:
      SERVERLESS_ALIAS: live

<function-name>:
  warmup:
    enabled: true
0reactions
juanjoDiazcommented, Jan 14, 2021

By the way, i havent yet tried on 5,x. Did you happen to publish that?

Yes, I have.

It has some breaking changes so look at the readme for the migration guide. It has some very useful extra functionality.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambda function aliases - AWS Documentation
You can create one or more aliases for your Lambda function. A Lambda alias is like a pointer to a specific function version....
Read more >
AWS CloudWatch Rules fail to trigger lambda functions after ...
I want to make the alias of an AWS lambda function point to another version. Since I can't find how to update an...
Read more >
SNS Topic Subscription does not trigger Lambda function if a ...
When passing the ARN of a specific lambda function version or alias to the endpoint parameter of the aws_sns_topic_subscription - the function ...
Read more >
Why you should not use Lambda aliases to define environments
In this post, we'll take a look at Lambda aliases, and highlight some of the pitfalls that may not be immediately obvious when...
Read more >
Serverless AWS alias plugin
This plugin enables use of AWS aliases on Lambda functions. The term alias must not be mistaken as the stage. Aliases can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found