Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[version 3.0.0-alpha6]: Error: useRecaptcha() is called without provider. #1628

Open
Prixii opened this issue Apr 21, 2024 · 2 comments
Open
Labels

Comments

@Prixii
Copy link

Prixii commented Apr 21, 2024

Description

i'm tring to use Checkbox in vue3, but console is outputting: Error: useRecaptcha() is called without provider.
i've tried to call useRecaptchaProvider() in App.vue and Login.vue, but it didn't work.

Minimal Reproducible Example

main.ts

import { createApp } from 'vue'
import App from './App.vue'

import router from './router'
import { VueRecaptchaPlugin } from 'vue-recaptcha'

const app = createApp(App)

app.use(router)
app.use(VueRecaptchaPlugin, {
  v2SiteKey: 'MY_KEY'
})

app.mount('#app')

login.vue

<template>
  <div class="login-container">
    <div>{{ response ? 'Verified' : 'Please click the checkbox' }}</div>
    <Checkbox :key="theme" v-model="response" :theme="theme" />
  </div>
</template>

<script lang="ts" setup>
import { Checkbox, useRecaptchaProvider } from 'vue-recaptcha'
import { ref } from 'vue'

useRecaptchaProvider()

const theme = ref<'light' | 'dark'>('light')
const response = ref()
</script>
<style lang="scss" scoped></style>

System info

context.mjs:8 Uncaught (in promise) Error: useRecaptcha() is called without provider.
at useRecaptchaContext (context.mjs:8:11)
at useAssertV2SiteKey (context.mjs:17:15)
at useChallengeV2 (challenge-v2.mjs:12:19)
at useComponentV2 (component-v2.mjs:5:83)
at setup (Checkbox.vue:46:18)
at callWithErrorHandling (runtime-core.esm-bundler.js:193:18)
at setupStatefulComponent (runtime-core.esm-bundler.js:7606:25)
at setupComponent (runtime-core.esm-bundler.js:7567:36)
at mountComponent (runtime-core.esm-bundler.js:5894:7)
at processComponent (runtime-core.esm-bundler.js:5860:9)

@Prixii Prixii added the bug label Apr 21, 2024
@DanSnow
Copy link
Owner

DanSnow commented Apr 28, 2024

I tried to use a simple project created by create-vue with the provided code and can't reproduce this. Could you provide a reproducible example with the build config?

@imzoloft
Copy link

I had this issue using 3.0.0-alpha.2, switched to 3.0.0-alpha.6 and it worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants