KyleRoss / node-lambda-log

Basic logging mechanism for Node.js Lambda Functions and other AWS services, which produces logs in JSON format for easier reading through Cloudwatch Logs.
https://lambdalog.dev
MIT License
193 stars 16 forks source link

lambda_log_default.a is not a constructor #79

Closed quickdraw6906 closed 2 years ago

quickdraw6906 commented 3 years ago

What happens?

undefined ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"lambda_log_default.a is not a constructor"

Steps to reproduce

/lib/logging.ts: import LambdaLog from "lambda-log"; export const logger: LambdaLog = new LambdaLog();

/util/logging.ts: import { logger } from "../libs/logging";

/src/somefile.ts: import * as logger from "../util/logging"; logger.info('something');

Any logs, output, examples?

undefined ERROR Uncaught Exception {"errorType":"TypeError","errorMessage":"lambda_log_default.a is not a constructor","stack":["TypeError: lambda_log_default.a is not a constructor"," at Module. (/var/task/src/psi_service_products/webpack:/home/ubuntu/workspace/ods-lambda-deploy/ods_lambda/etl/src/libs/logging.ts:10:34)"," at __webpack_require__ (/var/task/src/psi_service_products/webpack:/webpack/bootstrap:19:1)"," at /var/task/src/psi_service_products/webpack:/webpack/bootstrap:83:1"," at Object. (/var/task/src/psi_service_products/psiServiceProducts.js:87:10)"," at Module._compile (internal/modules/cjs/loader.js:1085:14)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)"," at Module.load (internal/modules/cjs/loader.js:950:32)"," at Function.Module._load (internal/modules/cjs/loader.js:790:12)"," at Module.require (internal/modules/cjs/loader.js:974:19)"," at require (internal/modules/cjs/helpers.js:93:18)"]}

Environment

Operating System: AWS Lambda

Node Version: Node.js 14.x

KyleRoss commented 3 years ago

@quickdraw6906 You are missing the curly braces:

import { LambdaLog } from "lambda-log";
export const logger: LambdaLog = new LambdaLog();