Ben754444 / react-cf-turnstile

A React library for Cloudflare Turnstile
MIT License
2 stars 0 forks source link

Invalid or missing type for parameter "sitekey", expected "string", got "object". #2

Closed zehawki closed 2 years ago

zehawki commented 2 years ago

Doesnt seem to be working - either with the example site key, nor my own.

index.js:1 [Cloudflare Turnstile] Invalid or missing type for parameter "sitekey", expected "string", got "object".
console.<computed> @ index.js:1
c @ api.js?render=explicit&onload=onloadTurnstileCallback:1
render @ api.js?render=explicit&onload=onloadTurnstileCallback:1
CFTurnstile.renderTurnstile @ index.tsx:111
(anonymous) @ index.tsx:89
callCallback @ react-dom.development.js:12318
commitUpdateQueue @ react-dom.development.js:12339
commitLifeCycles @ react-dom.development.js:20709
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
enqueueSetState @ react-dom.development.js:12467
push../node_modules/react/cjs/react.development.js.Component.setState @ react.development.js:365
(anonymous) @ index.tsx:88
Promise.then (async)
CFTurnstile.componentDidMount @ index.tsx:87
commitLifeCycles @ react-dom.development.js:20663
commitLayoutEffects @ react-dom.development.js:23426
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
commitRootImpl @ react-dom.development.js:23151
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
commitRoot @ react-dom.development.js:22990
performSyncWorkOnRoot @ react-dom.development.js:22329
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
workLoop @ scheduler.development.js:417
flushWork @ scheduler.development.js:390
performWorkUntilDeadline @ scheduler.development.js:157
index.tsx:113 Uncaught Error: Failed to render Turnstile
    at CFTurnstile.renderTurnstile (index.tsx:113:1)
    at CFTurnstile.<anonymous> (index.tsx:89:1)
    at callCallback (react-dom.development.js:12318:1)
    at commitUpdateQueue (react-dom.development.js:12339:1)
    at commitLifeCycles (react-dom.development.js:20709:1)
    at commitLayoutEffects (react-dom.development.js:23426:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
    at invokeGuardedCallback (react-dom.development.js:4056:1)
    at commitRootImpl (react-dom.development.js:23151:1)
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at commitRoot (react-dom.development.js:22990:1)
    at performSyncWorkOnRoot (react-dom.development.js:22329:1)
    at react-dom.development.js:11327:1
    at unstable_runWithPriority (scheduler.development.js:468:1)
    at runWithPriority$1 (react-dom.development.js:11276:1)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11322:1)
    at flushSyncCallbackQueue (react-dom.development.js:11309:1)
    at scheduleUpdateOnFiber (react-dom.development.js:21893:1)
    at Object.enqueueSetState (react-dom.development.js:12467:1)
    at push../node_modules/react/cjs/react.development.js.Component.setState (react.development.js:365:1)
    at index.tsx:88:1
Ben754444 commented 2 years ago

@zehawki could you show me the props you are passing to the component?

zehawki commented 2 years ago

Exact same props as your example.

Note that after I hit the error with this package, I used https://github.com/Le0Developer/react-turnstile instead and its working just fine.

Ben754444 commented 2 years ago

Looks like there was a mistake in the example - sorry about that. If you wish to continue using this package, change siteKey to sitekey.

zehawki commented 2 years ago

Ahhhhhhh, sorry. I also didnt notice that little detail.