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.

Allow warmup of Unqualified Alias

See original GitHub issue

There is currently no way of warming up the Unqualified alias. From what I see in the code there is a way of setting a specific alias via an env variable, otherwise it will default to $LATEST. Which is fine in most of the cases. Up until API Gateway V2 showed up.

The problem arises in this scenario: Deploy a function and attach API Gateway V2. It will, by default, link the Unqualified alias of the function. There is currently no plugin that allows you to both create aliases and link the correct alias in API Gateway. There is some kind of CF template you can use to get very close (without having to create a custom plugin) where you can disable versioning from serverless, have a script that automatically generates a unique name for the versioning step, then create the alias and/or switch the version on the alias. The last bit I wasn’t able to work out is how to link a specific alias in API Gateway V2, I guess it’s so “new” that wasn’t really taken seriously, or API Gateway V1 is so deep in the serverless logic that will require some kind of refactoring. Anyway, that’s is a different story.

What happens, and I proved it myself (although the AWS support sent me a confused response), is that if you warm up the $LATEST version, the Unqualified alias won’t be warmed up, although by default is linked to $LATEST.

To validate what I am saying you can:

  • create a new Lambda function
  • start the warmer on $LATEST - you will see in the monitor of $LATEST the executions of the warmer function
  • switch to the Unqualified alias - the monitor won’t show any sign of the warmer running
  • the first execution in Unqualified will have a cold start
  • now create a new alias and point it to $LATEST
  • test the new alias, you will have a cold start

Now, if Lambda supported the setting of env variables as empty, this would be just a matter of creating an empty env variable in the lambda function via serverless, but you can’t create empty env variables in Lambda.

It would be great if there was a workaround to this issue and have the warmup (optionally) to run on the Unqualified alias.

I already tried setting Unqualified as SERVERLESS_ALIAS and didn’t work

Warm Up Invoke Error: function ResourceNotFoundException: Function not found: arn:aws:lambda:function:Unqualified

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
juanjoDiazcommented, Jan 14, 2021

This took way to long but v5 is finally released.

0reactions
peppeocchicommented, Nov 16, 2020

@juanjoDiaz thanks for your reply, I already checked that plugin and it currently doesn’t support Api Gateway V2 (HTTP Gateway).

What I am really asking is that the Qualifier parameter gets removed when invoking the function, if specified by an env variable or some other way.

The AWS premium support has replied (it’s not the first time) with a copy&paste from their documentation.

Let me begin by saying that technically speaking the qualified latest version and the unqualified latest version are the same IF no other versions or alias exist. In this case, when you invoke a function using an unqualified ARN, Lambda implicitly invokes $LATEST.[1]

Don’t worry if you don’t want to make any changes, we have solved it by removing this plugin from the serverless config file after having deployed once. Then we removed the “Qualifier” parameter from the lambda function code and the warmup is working as expected. I’m sure we’re not the only one facing this issue and it’s a bit annoying having to manually do the above every time we need warmup in a new function.

This plugin works perfectly with API Gateway V1 because the API Gateway link to the lambda ARN includes the alias/version (e.g. $LATEST), with API Gateway V2 the alias/version is not there, not even the UI in the AWS console allows you to pick an alias/version, but you can manually paste in the full ARN and it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Plugin Warmup
Previous versions of the plugin used the $LATEST alias as default alias to warm up if no alias was provided. From v5, the...
Read more >
Serverless WarmUp Plugin - Morioh
WarmUp solves cold starts by creating a scheduled lambda (the warmer) that invokes all the selec. ... From v5, the unqualified alias is...
Read more >
podman no longer searches dockerhub: Error: short-name ...
NOTE: RISK OF USING UNQUALIFIED IMAGE NAMES We recommend always using fully qualified image names including the registry server (full dns ...
Read more >
Lambda function versions - AWS Documentation
You can use a qualified or an unqualified ARN in all relevant API operations. However, you can't use an unqualified ARN to create...
Read more >
Using Versions and Aliases to Pre-Warm Lambda Execution ...
In two recent posts I showed how to warm up execution environments ... In this post I'll show how to use Lambda versions...
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