Skip to content
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

Feature request: implement top-level await & ESM #1033

Closed
dreamorosi opened this issue Aug 2, 2022 · 4 comments · Fixed by #1736
Closed

Feature request: implement top-level await & ESM #1033

dreamorosi opened this issue Aug 2, 2022 · 4 comments · Fixed by #1736
Assignees
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility
Milestone

Comments

@dreamorosi
Copy link
Contributor

Description of the feature request

Problem statement
With ES modules, developers may use top-level await within their functions. This allows developers to use the await keyword in the top level of the file. With this feature, Node.js functions may now complete asynchronous initialization code before handler invocations.

In the context of the Parameters utility, this minimises the execution time in favor of a longer and single initialisation time as parameters that are shared across invocations could be fetched ahead and used immediately when the handler is executed.

Summary of the feature
For this feature to be possible two things need to happen:

  • Feature request: build as esmodule #521 must be resolved and the all the harnesses to build in ESM must be available
  • e2e tests must be implemented
  • docs need to make it clear that top-level async/await can be used only with ESM

Code examples
N/A

Benefits for you and the wider AWS community
Shorter execution times, simpler handler logic

Describe alternatives you've considered
Fetching all secrets in the handler's scope.

Additional context
Depending on the strategy that is decided in #521 examples should be provided in the docs for both ESM and CJS since the latter won't have access to top-level async/await.

Related issues, RFCs

#846
#521

@dreamorosi dreamorosi added triage This item has not been triaged by a maintainer, please wait blocked This item's progress is blocked by external dependency or reason parameters This item relates to the Parameters Utility labels Aug 2, 2022
@dreamorosi dreamorosi added this to the Parameters milestone Aug 2, 2022
@dreamorosi dreamorosi added this to Issues - Needs clarification or refinement (untriaged) in Issues via automation Aug 2, 2022
@dreamorosi dreamorosi removed the triage This item has not been triaged by a maintainer, please wait label Nov 13, 2022
@dreamorosi dreamorosi removed this from Issues - Needs clarification or refinement (untriaged) in Issues Nov 13, 2022
@dreamorosi dreamorosi changed the title Feature (parameters): implement top-level await & ESM Feature request: implement top-level await & ESM Nov 14, 2022
@dreamorosi dreamorosi added the feature-request This item refers to a feature request for an existing or new utility label Nov 14, 2022
@dreamorosi dreamorosi modified the milestones: Parameters - Beta release, ES modules support Feb 11, 2023
@dreamorosi dreamorosi self-assigned this Oct 12, 2023
@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation and removed blocked This item's progress is blocked by external dependency or reason labels Oct 12, 2023
@dreamorosi dreamorosi modified the milestones: ES modules support, Version 2.0 Oct 12, 2023
@dreamorosi dreamorosi added pending-release This item has been merged and will be released soon and removed confirmed The scope is clear, ready for implementation labels Oct 12, 2023
@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.

@marcioemiranda
Copy link

Hey @dreamorosi , do you have an alpha release for this already?

@dreamorosi
Copy link
Contributor Author

Hi @marcioemiranda, yes - I just published the first alpha release.

You can download it by running npm i @aws-lambda-powertools/parameters@next.

Note that I haven't yet been able to publish the docs, nor release notes, that's why I haven't announced it yet.

@github-actions github-actions bot added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Nov 1, 2023
@aws-powertools aws-powertools deleted a comment from github-actions bot Nov 2, 2023
@dreamorosi
Copy link
Contributor Author

This is available in preview starting from the 2.0.0-alpha.0 release. You can install this version using the next tag, i.e. npm i @aws-lambda-powertools/logger@next.

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 feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility
Projects
Development

Successfully merging a pull request may close this issue.

2 participants