aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.98k stars 560 forks source link

PublishVersionCommand creating new version each time regardless of any delta #5946

Closed asimboruwa-pivotree closed 3 months ago

asimboruwa-pivotree commented 3 months ago

Describe the issue

Calling PublishVersionCommand() creates a new version regardless of any code change or not. The documentation is very misleading - especially the part where it says "Lambda doesn't publish a version if the function's configuration and code haven't changed since the last version. Use UpdateFunctionCode or UpdateFunctionConfiguration to update the function before publishing a version."

The only way to publish a new version based upon code changes is by calling UpdateFunctionCodeCommand() and setting Publish:true. However, by using this method you do not get the ability to set a "Description" against the new published version. I am trying to set the commit message/id against each new published version. Currently, I do not see any way to set a description against a version that is uniquely created for the code change.

Links

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/lambda/command/PublishVersionCommand/

asimboruwa-pivotree commented 3 months ago

Update:

It turns out that it is an issue caused due to running cloudformation before publish version. It seems that running cloudformation update stack (via sdk) without having a change set review updates the lambda function somehow - even though there is no change in the code. This is the reason why a subsequent call to update function code or publish version creates a new version each time.

This is not the behaviour seen with state machine though. Running cloudformation is not causing any new version to be created unnecessarily.

RanVaknin commented 3 months ago

Hi @asimboruwa-pivotree ,

Thanks for reaching out.

The SDK's docs are generated from the main API docs for each operation which is owned by the service itself, and not the SDK team.

Please submit a documentation feedback at the top right side of the documentation page and it will go directly to the doc writers of that service.

Since this is not actionable by the SDK team I'm going to go ahead and close this.

Thanks again, Ran~

github-actions[bot] commented 3 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.