getsentry / spotlight

Your Universal Debug Toolbar
https://spotlightjs.com
Other
323 stars 11 forks source link

Spotlight crashes when using Sentry.getCurrentScope().addAttachment and Sentry.addBreadcrumb() #400

Open sergical opened 1 month ago

sergical commented 1 month ago

Environment

"@spotlightjs/spotlight": "^1.2.17",
"@sentry/nextjs": "^7.114.0",
"@sentry/profiling-node": "^7.114.0",

Steps to Reproduce

  1. Just adding some additional context inside an API route

Have a file that I'm attaching and some data for the breadcrumb. Not sure if there are limitations on either from Sentry's side rather than Spotlight, will test with my DSN directly

  Sentry.getCurrentScope().addAttachment({
    filename: 'invoice.pdf',
    data: Buffer.from(fileArrayBuffer),
  });

  Sentry.addBreadcrumb({
    category: 'invoicing',
    message: `Saving invoice ${invoiceId}`,
    data: {
      invoiceId,
      formattedInvoice,
    },
  });

Expected Result

Spotlight not to crash

Actual Result

sergical commented 1 month ago

Getting Unexpected token '%', "%����" is not valid JSON hmmmm maybe im sending data incorrectly :/

sergical commented 1 month ago

Yup, that was the issue, updated data to be appropriate, Spotlight doesn't crash - but no way to see the breadcrumb or attachment inside spotlight, right?

Shubhdeep12 commented 1 month ago

hi @sergical thanks for creating this thread.

Currently, in Spotlight, we list events caused by any errors along with all the traces. However, we are not displaying all the events we receive. Breadcrumbs are visible, but only within Error Events for better debugging.

Regarding the error you got above, yes the Spotlight UI crashes while parsing the events with attachments attached to scope. This happens because we are not currently parsing the attachments received with the events.

Sorry for the inconvenience. I'll let you know here once this is fixed.