serverless-prune-plugin icon indicating copy to clipboard operation
serverless-prune-plugin copied to clipboard

[Bug] All versions deleted regardless of -n flag

Open richardcook-brandlive opened this issue 2 years ago • 4 comments

Steps to reproduce:

yarn add --dev serverless-prune-plugin
// Add plugin to serverless file
sls prune -n 10 --stage {stage}  --dryRun 

All versions for all functions in file will be marked as selected for deletion. Running without --dryRun will delete all versions.

Environment Info:

Serverless: 2.4
yarn: 1.22.10
serverless-prune-plugin: ^2.0.1
Ubuntu: 20.04.2 LTS

richardcook-brandlive avatar Feb 03 '22 00:02 richardcook-brandlive

Hi @richardcook-brandlive — I am able to reproduce this issue. It worked as expected using the Framework + Plugin versions provided in a test project that I attempted. Can you provide additional clarity?

Or perhaps if others also encounter this, we'll see additional comments on this issue.

claygregory avatar Feb 25 '22 02:02 claygregory

I'm having the same issue. I added the number to serverless.yml file as 3, but all the versions were deleted.

SquareLi avatar Oct 11 '22 01:10 SquareLi

I can also replicate this using "serverless-prune-plugin": "^2.0.1"

sls -v
Framework Core: 2.57.0 (local)
Plugin: 5.4.4
SDK: 4.3.0
Components: 3.16.0

When running

sls prune -n 2 --region us-east-1 --stage staging

Plugins

plugins:
  - ./serverless-plugins/validation-rules # plugin-select incompatible with 2.x
  - serverless-webpack
  - serverless-plugin-select # allow function deployment to specific regions
  - serverless-lambda-edge-pre-existing-cloudfront # deploy functions to edge
  - serverless-dynamodb-local
  - serverless-offline
  - serverless-add-api-key # use on multiple apis
  - serverless-create-global-dynamodb-table
  - serverless-stage-manager # prevent typos in stage names
  - serverless-deployment-bucket # create deployment bucket if does not exist
  - serverless-prune-plugin

benswinburne avatar Nov 24 '22 15:11 benswinburne