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

Nuxt 3 "Error: Invariant violation: Please load enterprise recaptcha script first" #1464

Open
mojabyte opened this issue Nov 29, 2023 · 0 comments
Labels

Comments

@mojabyte
Copy link

Description

The enterprise script doesn't load. Using enterprise: true in Nuxt 3 and calling the execute provided from useChallengeV3 causes this error:

Error: Invariant violation: Please load enterprise recaptcha script first
    at invariant (utils.mjs?v=c6c10ab5:8:11)
    at getEnterpriseRecaptcha (enterprise-helper.mjs?v=c6c10ab5:3:3)
    at Object.execute (proxy.mjs?v=c6c10ab5:28:14)
    at async execute (challenge-v3.mjs?v=c6c10ab5:10:31)

I tried adding the enterprise script manually, and it worked without a problem.

Minimal Reproducible Example

nuxt.config.ts

export default defineNuxtConfig({
  runtimeConfig: {
    public: {
      recaptcha: {
        v3SiteKey: 'X',
      },
    },
  },
  recaptcha: {
    enterprise: true,
  },
});

Form.vue

<template>
  <form @submit="onSubmit">
    ...
  </form>
</template>

<script lang="ts" setup>
const { execute } = useChallengeV3('submit');

const onSubmit = async () => {
  const response = await execute();
  console.log(response);
};
</script>

System info

------------------------------
- Operating System: Linux
- Node Version:     v20.9.0
- Nuxt Version:     3.6.5
- Nitro Version:    2.5.2
- Package Manager:  [email protected]
- Builder:          vite
- User Config:      app, css, modules, runtimeConfig, content, devtools, gtm, i18n, nitro, postcss, recaptcha, site, sitemap, robots, veeValidate, vite
- Runtime Modules:  @nuxt/[email protected], @nuxtjs/[email protected], @vee-validate/[email protected], @zadigetvoltaire/[email protected], [email protected], [email protected], [email protected], vue-recaptcha/nuxt
- Build Modules:    -
------------------------------
@mojabyte mojabyte added the bug label Nov 29, 2023
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

1 participant