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
Configuring via .env variables on Nuxt 3 #84
Comments
Hey @Lexpeartha Could you try to rebuild your project or and remove node modules? I am using env variables in module repo, demo projects, tutorials, and many more so this issue seems wuite strange |
I was running nuxt 3 edge version, but down-graded it to rc 6 and issue was still there |
Could you please create a reproduction repository in Stackblitz? I tried it once again and was not able to reproduce it. |
Well... I can't reproduce it now since it started working for my project as well 🤷🏽♂️ |
I see. Thank you for testing it out. I hope the module will work for you kow without any issues. Happy coding! 😃 |
I am seeing this issue on 1.1.1. Running Nuxt 3.0.0-rc.8 |
@Baroshem Not sure what might be causing the problem to appear again, but it would be great if you could update |
Yes, the update to the newest version of nuxt and nuxt/ki is a planned feature. I want to release it next week preferably with #83 as a 1.2.0. I just need to test some things out to not cause breaking changes for your projects :) |
@Baroshem I can confirm this bug.. the solution is to move the algolia config to Works: export default defineNuxtConfig({
modules: ['@nuxtjs/algolia'],
runtimeConfig: {
FOO: process.env.FOO,
public: {
algolia: {
apiKey: "12345678",
applicationId: "123",
instantSearch: true
},
}
},
algolia: {
apiKey: "12345678",
applicationId: "123",
instantSearch: true
},
}) Fails: export default defineNuxtConfig({
modules: ['@nuxtjs/algolia'],
runtimeConfig: {
FOO: process.env.FOO,
public: {
anyKey: '123'
}
},
algolia: {
apiKey: "12345678",
applicationId: "123",
instantSearch: true
},
}) The Bug seems to be that if you define a public runtime there is no merge from the Algolia config and the general public runtime config. Not sure if this is a Nuxt Bug or from this Module. But i guess it's on Nuxt side as a downgrade to a earlier release fixes the issue. |
Closing an issue since everything seems to work fine in newer nuxt release candidates 👍🏽 |
I still have the error on RC 11 after having destroyed node_modules and .nuxt... but it worked if I duplicate algolia config object in runtimeConfig.public |
I would say then that this issue may be caused by the Nuxt itself rather than the module but I will investigate on my side. Have you tried modifying the module code in node_modules to see if it makes a difference? |
Well, I wouldn't dare... ;-) |
Folks, The issue is caused when you have both algolia object and runtimeConfig.public both registered in nuxt.config.ts file. I will release a fix today to fix this issue. |
Should be working now with 1.1.4 version |
Guys, I am closing the issue as it was tested already in a few Nuxf 3 apps with public runtime config. If this error occurs again, please reopen. |
Version
@nuxtjs/algolia: 1.1.1
nuxt: 3.0.0-rc.6
Steps to reproduce
env
variablesWhat is happening?
When starting a project error is thrown
Cannot destructure property 'applicationId' of '__vite_ssr_import_0__.useRuntimeConfig(...).algolia' as it is undefined.
Not sure if this has something to do with #81 or #63 but considering the example in the playground, this should work
The text was updated successfully, but these errors were encountered: