New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-csharp create template uses handler-specific artifact #5411

Merged
merged 2 commits into from Dec 31, 2018

Conversation

Projects
None yet
3 participants
@odedniv
Copy link
Contributor

odedniv commented Oct 22, 2018

What did you implement:

The problem:

  • The template for aws-csharp creates an artifact (using build.sh) called deploy-package.zip.
  • Serverless uploads all artifacts to the same prefix in the S3 bucket.
  • To create a second artifact for a second function the basename of the artifact needs to be changed to something else.
  • If you use the same basename (in another directory), you get an unexplained error during the deployment:
  An error occurred: HelloLambdaVersionGtHPSWSbQu5erGQ1qsmWTuL5axFax9OvH53cRMS4yHA - CodeSHA256 (buSKlTnYj3iptkvZOp+HzA1my2aAHCfzE9YYl0jQrqE=) is different from current CodeSHA256 in $LATEST (+5nQZZsPn2CzTTHHeZPKO6Kqt6XJJxVOboMVKg6pSHg=). Please try again with the CodeSHA256 in $LATEST. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 6823784f-d5d7-11e8-8c3b-bdc8b24e0fb1).

This error is confusing, and it took me a lot of time to realize that the problem is with the basename of the artifact.

Solution: In the template use a more specific artifact name (e.g. hello.zip for the hello function), so that the user understands it cannot be a generic and duplicate name (e.g. deploy-package.zip).

How did you implement it:

  • Changed aws-csharp template's build.sh to create a zip file called hello.zip (like the function's name).
  • Changed aws-csharp template's serverless.yml to use a function-specific artifact.

How can we verify it:

serverless create --tempate aws-csharp

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@horike37

This comment has been minimized.

Copy link
Member

horike37 commented Dec 31, 2018

@odedniv
Thank you for providing the solution and fixing 👍
Totally agree with you. LGTM 💯

@horike37 horike37 merged commit c1c1ee0 into serverless:master Dec 31, 2018

2 of 3 checks passed

coverage/coveralls Coverage decreased (-0.3%) to 90.79%
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@odedniv odedniv deleted the odedniv:aws-csharp-template branch Dec 31, 2018

dschep added a commit that referenced this pull request Jan 9, 2019

v1.36.0 release!
 - [Log AWS SDK calls in debug mode](#5604)
 - [Added currently supported regions for GCP functions](#5601)
 - [Update Cloudflare Templates](#5620)
 - [AWS: Validate rate/cron syntax before Deploy](#5635)
 - [Fix error log output](#5378)
 - [Support for native async/await in AWS Lambda for aws-nodejs-typescript template ](#5607)
 - [aws-csharp create template uses handler-specific artifact](#5411)
 - [change behaviour on initial stack create failed](#5631)
 - [Add warning for multiple functions having same handler](#5638)
 - [AWS: Add API Gateway stage name validation.](#5639)

@dschep dschep referenced this pull request Jan 9, 2019

Merged

v1.36.0 release! #5670

@shortjared shortjared added this to the 1.36.0 milestone Jan 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment