serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

`sls deploy function` doesn't create new requirements layer version

Open brettdh opened this issue 2 years ago • 2 comments

I have a Django app that I want to deploy in these steps:

  1. Deploy a single function, manage, that is used for running (you guessed it) manage.py commands
  2. Run the manage function to run Django migrations
  3. Deploy the rest of the functions in my Django app

When I attempt (1), though, using sls deploy function -f manage, I notice that in step (2), a new dependency I just added to my requirements.txt (since the last deploy of the manage function) isn't available in the manage function. Further, I'm using layer: true in my serverless.yml, and I noticed that a new Lambda layer version was not created when i ran step (1) - which explains the missing dependency.

How can I continue using a Lambda layer for my Python requirements, while making sure that deploying a single function includes a new version of the requirements layer if needed? Is this a bug in serverless-python-requirements?

brettdh avatar Jun 03 '22 21:06 brettdh

Here's a minimal repro: https://github.com/brettdh/serverless-layer-test

Note, however, that the issue also appears to manifest when not using this plugin; sls deploy function just doesn't seem to update lambda layers at all. For the app that does use this plugin, however, I notice that the requirements layer is not getting updated even when I have added a new dependency to requirements.txt and do a full deploy (not just one function)

I'll leave this open in case y'all have any insights, but I'm going to also open an issue on serverless/serverless.

brettdh avatar Jun 07 '22 14:06 brettdh

Update: opened serverless/serverless#11141.

brettdh avatar Jun 07 '22 18:06 brettdh