Open
Description
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
{
"errorType": "ReferenceError",
"errorMessage": "Error resolving module '/var/task/console' from '/var/task/index.js'",
"stackTrace": [
" at ../../node_modules/@aws-lambda-powertools/logger/lib/Logger.js (/var/task/index.js:1652:26)",
" at __require2 (/var/task/index.js:15:17)",
" at ../../node_modules/@aws-lambda-powertools/logger/lib/index.js (/var/task/index.js:2555:18)",
" at __require2 (/var/task/index.js:15:17)",
" at <anonymous> (/var/task/index.js:2562:29)",
""
]
}
// esbuild output, failing code snippet
/** ... **/
var require_Logger = __commonJS({
"../../node_modules/@aws-lambda-powertools/logger/lib/Logger.js"(exports) {
"use strict";
var __importDefault = exports && exports.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
var node_crypto_1 = __require("crypto");
var node_console_1 = __require("console");
/** ... **/
// index.ts
import { Logger } from '@aws-lambda-powertools/logger'
export const handler = async () => {
const logger = new Logger()
logger.info('Hello world')
return {
body: JSON.stringify({
hello: 'world',
}),
statusCode: 200,
}
}
Solution/User Experience
LLRT offers up to over 10x faster startup and up to 2x overall lower cost compared to other JavaScript runtimes running on AWS Lambda
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
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
On hold