serverless-sentry-lib icon indicating copy to clipboard operation
serverless-sentry-lib copied to clipboard

Error while using sourcemaps

Open alexw23 opened this issue 3 years ago • 1 comments

I've been having issues using sourceMaps: true, it doesn't seem to append app://. After some debugging I found the cause to be the following line:

https://github.com/arabold/serverless-sentry-lib/blob/e0b4c26084d1c7c98a0379ade343ae2b699d09a4/src/index.ts#L168

Wrapping this line in a try catch to log any errors, and throws the following error:

Cannot read properties of undefined (reading 'basename') at RewriteFrames.iteratee

In the dist/index.js file this looks like:

frame.filename = "app:///".concat(path_1.default.basename(frame.filename));

I updated this to the following to make it work:

frame.filename = "app:///".concat(path_1.basename(frame.filename));

I'm wondering if this import statement should be import * as path from 'path'.

alexw23 avatar Feb 02 '23 00:02 alexw23

Thanks for the detailed report! I've opened PR #42 to fix this. It addresses the path import issue causing the basename error when using sourceMaps: true. Please take a look and let me know if this resolves the problem for you!

webbrain-one avatar Aug 10 '26 13:08 webbrain-one