hCaptcha / react-hcaptcha

hCaptcha Component Library for ReactJS and Preact
MIT License
367 stars 41 forks source link

Type errors upgrading from 1.8.1 to 1.9.0+ #217

Open Yoseftickx opened 9 months ago

Yoseftickx commented 9 months ago

After automatically upgrading from 1.8.1 to 1.9.3 when attempting to render the component within our react app, the application errors out.

The error logged to console is

index.mjs:19 Uncaught TypeError: He.setPropagationContext is not a function
    at Le._createRouteTransaction (index.mjs:19:33670)
    at index.mjs:19:32267
    at Bi (index.mjs:19:30359)
    at Le.setupOnce (index.mjs:19:31995)
    at Yn (index.mjs:11:2135)
    at index.mjs:11:2099
    at Array.forEach (<anonymous>)
    at qr (index.mjs:11:2078)
    at st.setupIntegrations (index.mjs:11:6825)
    at ce.bindClient (index.mjs:7:9333)
    at new ce (index.mjs:7:9232)
    at Jn (index.mjs:19:35327)
    at HCaptcha.componentDidMount (index.js:55:32)
    at commitLifeCycles (react-dom.development.js:19814:1)
    at commitLayoutEffects (react-dom.development.js:22803:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:188:1)
    at HTMLUnknownElement.sentryWrapped (helpers.js:90:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:237:1)
    at invokeGuardedCallback (react-dom.development.js:292:1)
    at commitRootImpl (react-dom.development.js:22541:1)
    at unstable_runWithPriority (scheduler.development.js:653:1)
    at runWithPriority$1 (react-dom.development.js:11039:1)
    at commitRoot (react-dom.development.js:22381:1)
    at finishSyncRender (react-dom.development.js:21807:1)
    at performSyncWorkOnRoot (react-dom.development.js:21793:1)
    at react-dom.development.js:11089:1
    at unstable_runWithPriority (scheduler.development.js:653:1)
    at runWithPriority$1 (react-dom.development.js:11039:1)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11084:1)
    at flushSyncCallbackQueue (react-dom.development.js:11072:1)
    at flushPassiveEffectsImpl (react-dom.development.js:22883:1)
    at unstable_runWithPriority (scheduler.development.js:653:1)
    at runWithPriority$1 (react-dom.development.js:11039:1)
    at flushPassiveEffects (react-dom.development.js:22820:1)
    at react-dom.development.js:22699:1
    at workLoop (scheduler.development.js:597:1)
    at flushWork (scheduler.development.js:552:1)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:164:1)

I dont know really have time to create a minimal reproducible but comparing the versions I saw the use of sentry was added with its own flag.

based off the error above being thrown from componentDidMount and I can see sentry was added as part of the 1.9.0 release into the method https://github.com/hCaptcha/react-hcaptcha/commit/ebce9b18974d6e3c4ad7c08e37b70334d4218e32#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R53

I think its possible this is not playing nicely with our sentry instance in our own app. When setting sentry=false I'm able to avoid the error. I'm happy to keep doing that but just wanted to flag this as a possible issue that might need to be address or even just to know a bit more what is happening. Additionally this behaviour is present in every version upto the current release as of writing of 1.9.3

for reference the installed version of @sentry/browser and @sentry/react in the consuming app are 7.53.1.

e271828- commented 9 months ago

@Yoseftickx thanks for the report, we'll take a look. Leaving our sentry integration disabled sounds like the right answer for the moment.