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

"Cannot parse given Error object"

Open patricsteiner opened this issue 2 years ago • 2 comments

Anyone else encountering this error? Seems to happen quite randomly 🤔

message: "Cannot parse given Error object",
originalStack: "ZoneAwareError@http://localhost:4201/vendor.js:66340:29\nparse@https://eu.posthog.com/static/recorder-v2.js?v=1.57.2:18:12414\nd@https://eu.posthog.com/static/recorder-v2.js?v=1.57.2:18:17328..."

patricsteiner avatar May 22 '23 20:05 patricsteiner

Yes, this happens very consistently when throwing an AbortError from an abort controller.

✅ I've verified this happens from screen recordings being triggered upon errors (e.g. the setting where Posthog will record the user's actions around the time an error occurs, since the React error says recording in it).

Disabling screen recordings fixes this locally and you probably don't need screen recordings on your localhost anyways.

Screenshot 2023-08-17 at 5 33 03 PM Screenshot 2023-08-17 at 5 33 00 PM Screenshot 2023-08-17 at 5 32 41 PM

iwasrobbed avatar Aug 17 '23 21:08 iwasrobbed

Getting this error in ErrorStackParser.parse(ingest/node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser)

../node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js in ErrorStackParser.parse at line 35:19

        }
        else if (error.stack) {
            return this.parseFFOrSafari(error);
        }
        else {
            throw new Error('Cannot parse given Error object');
        }
    },
    extractLocation: function (urlLike) {
        if (urlLike.indexOf(':') === -1) {
            return [urlLike];

../node_modules/rrweb/es/rrweb/packages/rrweb/src/plugins/console/record/index.js in unhandledrejectionHandler at line 78:44

                payload = [
                    stringify('Uncaught (in promise)', logOptions.stringifyOptions),
                    stringify(event.reason, logOptions.stringifyOptions),
                ];
            }
            const trace = ErrorStackParser.parse(error).map((stackFrame) => stackFrame.toString());
            cb({
                level: 'error',
                trace,
                payload,
            });

../../node_modules/@sentry/browser/esm/helpers.js in sentryWrapped at line 85:17

      // Attempt to invoke user-land function
      // NOTE: If you are a Sentry user, and you are seeing this stack frame, it
      //       means the sentry.javascript SDK caught an error invoking your application code. This
      //       is expected behavior and NOT indicative of a bug with sentry.javascript.
      return fn.apply(this, wrappedArguments);
    } catch (ex) {
      ignoreNextOnError();
      withScope((scope) => {
        scope.addEventProcessor((event) => {

mmubasher avatar Aug 31 '23 10:08 mmubasher

sorry nobody replied here... that error line is no longer in the rrweb repo so i'll assume this is fixed as a result, feel free to reopen if needed

pauldambra avatar Jul 11 '24 20:07 pauldambra