Turnstile disabled during Nuxt3 app build due to empty siteKey
vanling opened this issue ยท 2 comments
๐ The bug
Turnstile disabled during Nuxt3 app build on Jenkins due to empty siteKey configuration value
During the build, Turnstile gets disabled due to empty values in the config options, as indicated by the warning message:
WARN @nuxtjs/turnstile is disabled as no site key was provided.
๐ ๏ธ To reproduce
- Set up a Nuxt3 with Turnstile integration
- Leave the config options siteKey and secretKey empty.
- Use environment variables NUXT_TURNSTILE_SECRET_KEY and NUXT_PUBLIC_TURNSTILE_SITE_KEY at runtime.
๐ Expected behaviour
Turnstile should not be disabled during the build process, since the environment variables for site key and secret key can be set at runtime.
โน๏ธ Additional context
The issue occurs when building Nuxt3 applications with Turnstile integration externally of where the .output of nuxt is run. The environment variables NUXT_TURNSTILE_SECRET_KEY and NUXT_PUBLIC_TURNSTILE_SITE_KEY are used at runtime to replace the empty values in the config options siteKey and secretKey.
Currently saving random strings in the config to make sure its not getting disabled during build and overwrite the random strings during runtime.
Now released in 0.4.0. Let me know if all is working for you.
@danielroe seems to be working :D thank you.
[info] Using html-validate to validate server-rendered HTML
[info] [nuxt:tailwindcss] Using default Tailwind CSS file from runtime/tailwind.css
[warn] [turnstile] No site key was provided. Make sure you pass one at runtime by setting NUXT_PUBLIC_TURNSTILE_SITE_KEY.
[log] โ Router autocompletions generated ๐ฆ