-
Notifications
You must be signed in to change notification settings - Fork 139
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: Support LLRT (Low Latency Runtime) #2050
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @NimmLor , thanks for raising the issue. This is strange, folling the compatibility matrix of LLRT, both crypto and node are supported. Can you provide more information on the Lambda settings and how you packaged the code (versions, package.json, any relevant tools used). Happy to look into the issue and bring Powertools to LLRT. |
Hi @am29d, I've quickly setup a demo repository for testing the LLRT with AWS CDK. |
I tried the example and something is odd with the LLRT, @dreamorosi was faster than me to open an issue in their repo. |
Hi, I am able to reproduce the error you showed in the initial post but the issue is with LLRT rather than with Powertools. As you mentioned, the code throws an error when importing the import { Console } from "node:console";
const con = new Console({ stdout: process.stdout, stderr: process.stderr });
export const handler = async (event: any) => {
con.log("Hello, world!");
return "Hello, world!";
}; Once deployed using the
After taking a look at the LLRT repo, and in light of this error, I think the compatibility matrix might be wrong. The table lists the I have opened an issue on their repo so that they can confirm whether the module is expected to work or not, and if not, to ask whether there's any chance that it will be implemented. As a side note, I want to remark that according to both our tenets (see first point) and versioning policy (see dependency lifecycle section) our current priority is to officially support AWS Lambda managed runtimes - aka LLRT has been met with remarkable positive feedback and shows a lot of promise, however while we are excited about it and eager to see where it goes, making significant changes to Powertools to support it would be premature since LLRT itself is considered experimental and subject to change. With that said, we are open to work with the LLRT team to fix this specific issue, and other similar ones where LLRT is missing support for common Node.js APIs. Likewise, we are open to consider making changes on our side only as long as they don't impact compatibility, DX, and performance with the main Node.js runtimes. |
Hi, thanks for the effort to reproduce the issue. I totally agree with your thoughts on the compatibility matrix and the priority of supporting AWS Lambda managed runtimes. I kind of expected that the issue lies within LLRT rather than Powertools. I looked through the esbuild output and it seems there are no other unsupported node apis being accessed, except a single I've also looked into the powertools tracer, and it obviously is far from being compatible with LLRT. Again looking at the esbuild output, it seems that the tracer is using many of the (some planned to be supported) unsupported node apis (such as util, assert, async_hooks, dgram, fs, http, os, querystring, url). This seems to require a huge effort to get the tracer running with LLRT and I totally understand that this shouldn't be addressed until LLRT is considered stable. I'm looking forward to the response from the LLRT team and I'm happy to help with testing and debugging if needed. Thanks! |
Not sure if this helps, but at least for the Metrics package, if I patch it to lazy-load I removed the setConsole() {
if (!this.getEnvVarsService().isDevMode()) {
const node_console_1 = require("node:console");
this.console = new node_console_1.Console({
stdout: process.stdout,
stderr: process.stderr,
});
}
else {
this.console = console;
}
} |
Hi @perpil thank you for chiming in. Indeed making the import lazy and bypassing the logic that uses it via the While it's a solution, this is not the kind of DX we are aiming for, so I would still consider the lack of To this end, I'd appreciate your 👍 or comment on the linked issue if you'd like LLRT to improve compatibility with Powertools, that'd help to give more weight to the request. |
According to awslabs/llrt#130 partial support for As soon as they make a release and I can test the change I'll do so and report back here. |
LLRT have released a new beta version and the issue with I have opened an issue on their repo to track this: awslabs/llrt#302 LLRT also have opened an issue to track support for Powertools in general, which you can find here: awslabs/llrt#251 |
Hi, as mentioned above, |
Thanks for opening the PR, I left some more comments there on why I was reticent to remove it but on second thought I think it's safe to use template literals and remove the blocker. I have modified/commented on the LLRT repo about the change on our side. As far as I can tell we're still missing the Once LLRT releases the next beta, I'll test the Logger and see if we have everything. If anyone does it first I'd appreciate if they could report here. |
Seems like the PR's for supporting console, switching to template literals and crypto.randInt are now resolved, is there anything remaining here? |
The logger should be working as expected. When I tried the tracer the last time and analyzed the bundle I notized the following
However it's very likely that most of these were imported in aws-xray-sdk-core |
Yep, Tracer is the one lagging behind among the three core utilities, but no because of LLRT fault. All the modules mentioned come from AWS X-Ray SDK and for a number of reasons I don't expect LLRT to prioritize them in the short term. Logger and Metrics work without any issue on LLRT, and the same goes for Batch Processing. |
Use case
This feature request is about the beta of the new lightweight JavaScript runtime LLRT (Low Latency Runtime).
Currently, the Logger crashes when importing the "console" module.
Demo repository: https://github.com/NimmLor/aws-cdk-llrt-demo
Solution/User Experience
It would be great if the aws-lambda-powertools would support this runtime, usage should be exactly the same as for nodejs runtimes.
Alternative solutions
No response
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: