recaptcha-module: Error: ReCaptcha error: Failed to execute Error: Invalid site key or not loaded in api.js: xxx

Hi,

Getting the strange error above on my form submission.

            try {
                const token = await this.$recaptcha.execute('login')

                let body = new FormData( e.target );

                return axios.post( '/endpoint' , body)
                .then((res) => {

                    if ( res.data.status === 'mail_sent' )
                        e.target.reset()
                })

                // at the end you need to reset recaptcha
                await this.$recaptcha.reset()

            } catch (error) {
                console.log(error)
            }

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

Hi,

Getting the strange error above on my form submission.


            try {

                const token = await this.$recaptcha.execute('login')



                let body = new FormData( e.target );



                return axios.post( '/endpoint' , body)

                .then((res) => {



                    if ( res.data.status === 'mail_sent' )

                        e.target.reset()

                })



                // at the end you need to reset recaptcha

                await this.$recaptcha.reset()



            } catch (error) {

                console.log(error)

            }

Hello! You are exiting from your function by returning the axios.post, so the reset function never gets executed.