airbrake-js icon indicating copy to clipboard operation
airbrake-js copied to clipboard

error-stack-parser versions < 2.1.4 causes stack parsing to fail with `ErrorStackParser.parse is not a function` error

Open kjvarga opened this issue 2 years ago • 2 comments

🐞 bug report

Affected Package

The issue is caused by package @airbrake/node

Is this a regression?

Yes, we noticed that we weren't getting Airbrake stack traces in our node service for a few months. The regression likely occurred due to Dependabot version upgrades of error-stack-parser which still satisfied the version requirements of this package (^2.1.4) but which cause the regression in stack parsing and led to stack traces not being available in Airbrake.

Description

According to this thread:

We have deprecated v2.1.3, v2.1.2, v2.1.1, v2.1.0, and v3.0.0 using npm deprecate [email protected] "Please upgrade to error-stack-parser >= v2.1.4, see https://github.com/stacktracejs/error-stack-parser/issues/80".

This package should not allow any of the affected versions.

🔬 Minimal Reproduction

https://gist.github.com/...

See https://github.com/stacktracejs/error-stack-parser/issues/80 for more info and possible repro steps. Using v2.1.3 of error-stack-parser and trying to log an airbrake error for an exception should result in an error like (obviously stack and error details are specific to my setup & code):

🔥 Exception or Error





ErrorStackParser: TypeError: error_stack_parser_1.default.parse is not a function Error: No such token: 'card_0MEJ2FqWxM0n7YqD8YCITGJJ'
    at Function.generate (/Users/kvarga/Workdir/github.com/change/payment_service/node_modules/stripe/lib/Error.js:38:16)
    at res.toJSON.then.StripeAPIError.message (/Users/kvarga/Workdir/github.com/change/payment_service/node_modules/stripe/lib/StripeResource.js:190:35)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
ErrorStackParser: TypeError: error_stack_parser_1.default.parse is not a function Error: fake
    at Notifier.espProcessor [as _processor] (/Users/kvarga/Workdir/github.com/change/payment_service/node_modules/@airbrake/browser/src/processor/esp.ts:48:15)
    at Notifier.BaseNotifier.notify (/Users/kvarga/Workdir/github.com/change/payment_service/node_modules/@airbrake/browser/src/base_notifier.ts:150:22)
    at Notifier.notify (/Users/kvarga/Workdir/github.com/change/payment_service/node_modules/@airbrake/node/src/notifier.ts:77:24)
    at notify (/Users/kvarga/Workdir/github.com/change/payment_service/lib/airbrake.ts:27:24)
    at trackError (/Users/kvarga/Workdir/github.com/change/payment_service/lib/error_helper.js:24:5)
    at StripeRouter.routeRequest (/Users/kvarga/Workdir/github.com/change/payment_service/lib/gateway_router/stripe/router.js:52:7)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async createCharge (/Users/kvarga/Workdir/github.com/change/payment_service/routes/v2/charges/post.js:147:26)
    at async /Users/kvarga/Workdir/github.com/change/payment_service/middleware/json_promise_handler.ts:19:24


🌍 Your Environment

@airbrake/* version:




"@airbrake/node": "2.1.7",

Anything else relevant?

I'm using error-stack-parser 2.1.3

kjvarga avatar Dec 12 '22 21:12 kjvarga

This package actually references ^2.0.4, but thanks for the flag :)

jlowcs avatar Jan 03 '23 14:01 jlowcs

Take a look at:

https://github.com/dparish/airbrake-js-lite

That's only for browsers but when building that I used the latest version of error-stack-parser.

I'm not sure if it will fix it but it might.

dparish avatar Oct 01 '23 16:10 dparish