Serverless-next.js: Define the lambda function name

Created on 9 Nov 2019  路  11Comments  路  Source: serverless-nextjs/serverless-next.js

Is your feature request related to a problem? Please describe.
The name of the lambda function is a random string.

Describe the solution you'd like
Can I define my own name in yml?

next component

All 11 comments

Hi Daniel,
When will we have the next version with the support of the lambda name?

Thanks
Gary

I don鈥檛 think this would be too difficult to do. How about giving us a PR 馃槂

Hi
I'm tempted to start working on this, but need a little guidance. Would this imply adding a name property here and here?

@marcoschicote Yes it would be in those 2 places.

We need to make sure it works across deployments:

npx serverless deploy
npx serverless remove
npx serverless deploy # using the same name

Unfortunately the lambda@edge functions are not deleted on serverless remove. This is because of the time it takes for the cloudfront distribution to delete etc. Considering this, we need to check if reusing the same function name across multiple deployments works fine.

@marcoschicote Appreciate the help on this improvement!

Thanks lot
Gary

@marcoschicote Yes it would be in those 2 places.

We need to make sure it works across deployments:

npx serverless deploy
npx serverless remove
npx serverless deploy # using the same name

Unfortunately the lambda@edge functions are not deleted on serverless remove. This is because of the time it takes for the cloudfront distribution to delete etc. Considering this, we need to check if reusing the same function name across multiple deployments works fine.

Not sure I follow. Are you deleting the lambdas when a new deployment is generated? O generating new content for the same lambdas and uploading it?

@marcoschicote, the way cloudfront interacts with Lambda@Edge essentially means that we do not have control over when they are deleted. What happens is that cloudfront get's removed, and AWS says that sometime after CF is removed, the lambdas will get removed (normally within a few hours).

With the above in mind, the problem becomes that if you deploy with named lambdas, then subsequently remove your deployment, you would need to wait until AWS has removed those lambdas in order to redeploy with the same name. Unless of course, we can instruct AWS to just reuse the lambdas that are already present.

@barrysteyn and @marcoschicote, will the lambda always use the initial name during each deployment? If yes, deleting lambda should be only worried when we delete the whole deployment right? If this is the case, IMO it is totally fine to have a named lambda and wait for it to be deleted before cleaning up anything else manually.

Thanks
Gary

@barrysteyn and @marcoschicote, will the lambda always use the initial name during each deployment? If yes, deleting lambda should be only worried when we delete the whole deployment right? If this is the case, IMO it is totally fine to have a named lambda and wait for it to be deleted before cleaning up anything else manually.

Thanks
Gary

Hi, is it possible to define part of the lambda function name? I understand the necessity to generate random function names, but we use Dynatrace for monitoring and that requires us to attach handlers to lambda function names. This would also be possible to do with a regex, so if we had a partial pattern to look for (e.g. next-serverless-$random, that would make it a bit easier for us.

Thanks!

I agree with @doque

I came here to suggest using some sort of hash/UUID appended to the custom function name (similar to how next's own build IDs are generated). Subsequently, have the generated UUID could be output in some fashion so that dependent services may update themselves as needed with each newly named deployment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AaronMoat picture AaronMoat  路  3Comments

robsonkades picture robsonkades  路  3Comments

justinwhall picture justinwhall  路  5Comments

mekwall picture mekwall  路  5Comments

patricktyndall picture patricktyndall  路  3Comments