I have created a typescript serverless project fro...
# seed
d
I have created a typescript serverless project from this template https://github.com/serverless/serverless/tree/master/lib/plugins/create/templates/aws-nodejs-typescript I have two functions hello and hello2 with the same code, I have updated just
hello2
and expected seed to just deploy
hello2
but seed deployed both hello and hello2. Am I doing something wrong?
Logs
Copy code
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - seed-run-poc-dev
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - UPDATE_IN_PROGRESS - AWS::Lambda::Function - Hello2LambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - Hello2LambdaFunction
CloudFormation - UPDATE_COMPLETE - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - Hello2LambdaVersion3J3P63SegAQNgnQbKC10lKxHR1dVDpqkNd7EF5HpM
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersion62mp8Qc504doEo9TaAUjdqNcxhzz0NAMtjSr6toOzk
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - Hello2LambdaVersion3J3P63SegAQNgnQbKC10lKxHR1dVDpqkNd7EF5HpM
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - Hello2LambdaVersion3J3P63SegAQNgnQbKC10lKxHR1dVDpqkNd7EF5HpM
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersion62mp8Qc504doEo9TaAUjdqNcxhzz0NAMtjSr6toOzk
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - HelloLambdaVersion62mp8Qc504doEo9TaAUjdqNcxhzz0NAMtjSr6toOzk
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1632224742113
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1632224742113
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1632224742113
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - seed-run-poc-dev
CloudFormation - DELETE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1632224329011
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - Hello2LambdaVersion0fcU1ckjbI33sMHmpNJA6TUmzYygKC70hTzmUIy8
CloudFormation - DELETE_SKIPPED - AWS::Lambda::Version - HelloLambdaVersion6dBj7NabM25RFtkI6SpZ117bHGqlN1ABrOmMnI6NFuY
CloudFormation - DELETE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1632224329011
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - seed-run-poc-dev
f
Hey @dhanvi, do you have the serverless-seed plugin enabled? https://seed.run/docs/incremental-lambda-deploys
d
I missed that I will add it.
I am curious if we could implement the same using GitHub Actions.
f
Yeah, definitely should be. On the higher level, before u
sls deploy
, check if the CFN template has changed, if not, use AWS CLI to deploy specific changed Lambda functions.
d
Let me re-phrase my question, Does the serverless-seed plugin work with other CI/CD? obviously with some work.
@Frank I am still seeing that both the functions are getting deployed even though I have modified only one function, we are using typescript / webpack plugin is that a problem? or do we need extra configurations?
Copy code
$ seed deploy --incremental
  seed-run-poc-dev-hello2: Changes detected. Updating...
  seed-run-poc-dev-hello: Changes detected. Updating...
f
Hey @dhanvi often this happens when the webpacked code is changed. You can actually check by downloading the Lambda source zips before and after the deployment.
You can check if the files are the same by checking the checksum, ie.
Copy code
sha1sum {file}
Let me know what you find.
d
You can check if the files are the same by checking the checksum, ie.
Sorry I didn't get you, could you please point me towards some documentation/example
f
Yeah, you can check why both functions are uploaded like this: 1. Go into your AWS Lambda console and download the zip files for
hello
and
hello2
like this https://stackoverflow.com/a/41205928/7667989 2. Run sha1sum on both zip files 3. Make a change to 1 of the functions and git push to deploy to Seed. 4. If you see both functions are updated, repeat step 1-2 to download the zips again and get the checksum 5. If the checksum have changed for both zip files, you can unzip them and diff the files and see what has changed.
d
Got it you are expecting the final out from the webpack to not change the sha1sum if the code hasn't changed. I think this is not how the default webpack configuration works. Do you have an example typescript project which has this configuration enabled (for incremental builds)? I will also try and do my research.