-
Notifications
You must be signed in to change notification settings - Fork 7
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 RC Support #3
Comments
Oh. Will take a look in a bit! Thank you |
``Cool @wobsoriano! So to give you a bit more context: This is my import { getAuth } from 'firebase-admin/auth'
import formatUser from '~/helpers/format-user'
import app from '../config/firebase-admin.config'
// Acts like nuxtServerInit.
// Checks if token is valid on first load.
export default defineNuxtPlugin(async () => {
const token = useCookie('token', {
path: '/',
})
const user = useUser()
try {
if (token.value === undefined) return
const result = await getAuth(app).verifyIdToken(token.value)
user.value = formatUser(result)
} catch (e) {
console.log('AuthError: ' + e)
// Not authenticated or invalid token
token.value = null
}
}) The frontend is not loading then. On the backend console (while running [nuxt] [request error] Cannot read property 'Auth' of undefined
at $id_b788ed7e (./.nuxt/dist/server/server.mjs:15176:44)
at async __instantiateModule__ (./.nuxt/dist/server/server.mjs:16599:3) When I take out the code in the plugin, the frontend loads nicely. |
Hi @wobsoriano, I created a fork of your repo to make it easier to reproduce: https://github.com/areindl/nuxt3-firebase-auth-starter I upgraded to Nuxt 3 and now it shows the exact same error message. Do you have any idea yet? |
Thanks! I can replicate it too by updating to Nuxt RC. Still investigating the problem. |
Let's follow this issue nuxt/nuxt#13812 |
Can you guys please confirm if forcing nuxi upgrade works for you? |
Only |
I'll try to make a module out of this. So we can have auto-import firebase composables, auto-set cookies and stuff |
Hey @wobsoriano how is your work on the module progressing? Do you need help? |
Ditto that @wobsoriano - I would love a module for this. Happy to contribute. |
Similar problems. If I rename the middleware and auth files to not .ts I can get the UI but anytime trying to implement the firebase-admin calls basically falls flat on its face. |
Hi @wobsoriano
I had your starter running nicely with Nuxt 3 Beta. But today I upgraded to Nuxt 3 RC and it stopped working.
The error message on server side states that Auth is undefined.
Have you tried upgrading yet?
Best
Anton
The text was updated successfully, but these errors were encountered: