[nuxt] Could not access `nitro`
Has anyone faced similar problem?
[nuxt] Could not access
nitro
. The only available runtime config keys on the client side are public
and app
. See https://nuxt.com/docs/guide/going-further/runtime-config
for more information.
To test, I removed the client plugins (even the sever plugins) and also moved all keys into public and still get this warning on the browser console when running dev mode.
Any help would be appreciated
Thanks7 Replies
@Victor Neves show some code
probably you use useRuntimeConfig outside of the nuxt context
It isn't very easy to share code as it's a big project π
Let's see if sharing in which kind of files I'm using it if it's possible to get some idea
I'm using the useRuntimeConfig on components script setup, composables and server files
It looks like I'm hunting ghosts
I made an extreme test removing all useRuntimeConfig (replaced by hardcode values), deleted the .nuxt folder and when running the project in dev mode I still get the warnings
It isn't very easy to share code as it's a big project πAn ideal chance to improve your debugging skills and provide a reproduction π
that's what I have been doing a lot while migrating this project π
but seriously, this one is insane, I don't have useRuntimeConfig, no custom plugins, only external modules and we even deleted all pages (only left one) and removed the javascript on app.vue and we still get the warning π
I found the culprit
sidebase/nuxt-auth v0.8
I have downgraded to v0.7.2 and the warning was gone
now I need to restore everything to have 100% sure
confirmed
But it appears to be with a combination of the flow I have
Did a test on their repo example upgrading to v0.8 and didn't see the warning
Need to continue investigating it to see if I can reproduce it with a mall boilerplate
Now I was able to reproduce it using their repo example
So it looks like it has to do with something they ship on this last release
Already reported the bug on sidebase
And looking into the logs from the update I have the feeling that the warning is caused by this
https://github.com/sidebase/nuxt-auth/blob/b2ad71a9d572fb3237a4c5fb32475773437d1c9f/src/runtime/utils/kit.ts#L21
GitHub
nuxt-auth/src/runtime/utils/kit.ts at b2ad71a9d572fb3237a4c5fb32475...
π Nuxt user authentication and sessions via authjs (next-auth), local and refresh providers. nuxt-auth wraps NextAuth.js to offer the reliability & convenience of a 12k star library to the ...