arabold / serverless-sentry-lib

MIT License
32 stars 15 forks source link

Importing module exported with exports.default #19

Closed lpfeup closed 4 years ago

lpfeup commented 4 years ago

Usage section of the README indicates that it can be imported as below:

const Sentry = require("@sentry/node");
const SentryLambdaWrapper = require("serverless-sentry-lib");

However, as dist/index.js is exporting the module with exports.default=, SentryLambdaWrapper has to be imported as:

const SentryLambdaWrapper = require("serverless-sentry-lib").default;

Platform OS: Windows 10 Node.js: v12.16.1 (LTS)

arabold commented 4 years ago

v2.0.0 has been released; You should be able to import it either

const withSentry = require("serverless-sentry-lib");

or as ES6 mobule:

import withSentry from "serverless-sentry-lib";

Please note that the function has been completely reworked and in most cases it's sufficient to simply wrap your Lambda without passing any additional parameters. Check the updated README.md.