rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar
https://docs.rollbar.com/docs/javascript
MIT License
566 stars 213 forks source link

Error with Rollbar Integration on Cloudflare Workers: "addEventListener(): useCapture must be false." #1129

Open danielplan opened 6 months ago

danielplan commented 6 months ago

Issue Description:

I'm encountering an issue when using Rollbar with Astro 4 on the Cloudflare Workers JavaScript runtime. The error message I'm seeing is:

"addEventListener(): useCapture must be false."

What I did

I have integrated the Rollbar initialization script on the page level of Astro, to automatically catch errors in the SSR runtime.

import Rollbar from 'rollbar';
var rollbar = new Rollbar({
    accessToken: '<Access Token>',
    captureUncaught: true,
    captureUnhandledRejections: true,
    payload: {
        code_version: '1.0.0',
    },
});

Once i am trying to run this with wrangler, this error pops up. image

Questions

  1. Am I doing something wrong with the Rollbar integration in Astro 4 on Cloudflare JavaScript Runtime?
  2. Is it even possible to capture SSR errors with Rollbar in Astro/Vite-based Frameworks?
ignacio-nacho-barbano commented 3 months ago

I'm having the exact same issue in my open source SvelteKit project https://github.com/ignacio-nacho-barbano/typescale-garden/tree/cloud-client-deploy

This is the error on local wrangler, exactly the same I see through Cludflare image

BTW You can get around the issue by wrapping your rollbar instance in a try catch and making sure it exists befor using it. image