Skip to content

Maintenance: Refresh SAM examples #1140

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

Closed
14 of 18 tasks
dreamorosi opened this issue Nov 3, 2022 · 3 comments · Fixed by #1180
Closed
14 of 18 tasks

Maintenance: Refresh SAM examples #1140

dreamorosi opened this issue Nov 3, 2022 · 3 comments · Fixed by #1180
Assignees
Labels
completed This item is complete and has been merged/shipped documentation Improvements or additions to documentation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)

Comments

@dreamorosi
Copy link
Contributor

dreamorosi commented Nov 3, 2022

Summary

The repo contains SAM examples of how to use the libraries. These examples are one of the most visited pages in the repository and since they were released the project and its documentation has evolved. The examples should be updated to reflect that.

Why is this needed?

The SAM samples were first created several months ago and in the meantime several updates have happened, so it's time to refresh them.

Which area does this relate to?

Other

Solution

Below a list of changes in no particular order:

Updates to README

  • Change the section that reads "You will need to have a valid AWS Account in order to deploy these resources" to a "Note" with GitHub specific markdown (see here), so that it's better highlighted.
  • Link documentation about Layers in Layers section of the README
  • Modify X-Ray section of docs to point to CloudWatch Traces section instead
  • Remove the section that talks/lists all IDEs (see image in details below)
![Screenshot 2022-11-03 at 11 26 03](https://user-images.githubusercontent.com/7353869/199697804-a53d6c01-fbbf-4b42-96f3-c4df42f82c35.png)

Maintenance

  • Update Powertools dependencies to latest available at time of PR
  • Update all devDependencies to latest available & test that everything works
  • Move back code to examples/lambda-functions (where it was originally) & symlink (how it was originally)

Code

  • Update one Lambda function to use Middy middleware usage (see docs)
  • Update second Lambda to use Class-based/decorators usage (see docs)
  • Update third Lambda (manual usage - like it is now) and make sure all features are represented (see docs)
  • Move Powertools instances creation in shared file & import it throughout other files (see example here)
  • Make sure all functions are minified, have source maps, use NODE_OPTIONS: --enable-source-maps' ([here](https://docs.aws.amazon.com/lambda/latest/dg/typescript-exceptions.html)), and use AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1` (here)
  • Move DynamoDB client instantiation in separate shared file, reuse across functions (see example here) & apply tracing to it
  • Move from aws-sdk (v2) to @aws-sdk/client-dynamodb (v3 - docs) - keep DocumentClient
  • Add an example of HTTP call (i.e. fake retrieve data at some point) in each function at the beginning, use phin to make requests, make a request to https://httpbin.org/#/Dynamic_data/get_uuid and add the returned uuid to logs (with this), to main segment as annotation (see docs), and as metadata to metrics (using addMetadata).
  • All functions should log the incoming event: middleware/decorator via parameter, manual via a logger.info(...)

Acknowledgment

@dreamorosi dreamorosi added triage This item has not been triaged by a maintainer, please wait internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels Nov 3, 2022
@bpauwels
Copy link
Contributor

bpauwels commented Nov 7, 2022

@dreamorosi as discussed you can assign this to me, I will start working on this

@dreamorosi dreamorosi removed the triage This item has not been triaged by a maintainer, please wait label Nov 7, 2022
@dreamorosi dreamorosi added documentation Improvements or additions to documentation confirmed The scope is clear, ready for implementation labels Nov 13, 2022
@bpauwels
Copy link
Contributor

@dreamorosi I have just created a PR covering the mentioned changes

@dreamorosi dreamorosi linked a pull request Nov 22, 2022 that will close this issue
13 tasks
Repository owner moved this from Working on it to Coming soon in AWS Lambda Powertools for TypeScript Dec 19, 2022
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@dreamorosi dreamorosi added completed This item is complete and has been merged/shipped and removed confirmed The scope is clear, ready for implementation labels Mar 2, 2023
@dreamorosi dreamorosi moved this from Coming soon to Shipped in AWS Lambda Powertools for TypeScript Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped documentation Improvements or additions to documentation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants