You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minimal code example for the index.js (I can also provide a repo for this if it helps):
import React from 'react'
import { useUser, withUser, withUserTokenSSR } from 'next-firebase-auth'
import Header from '../components/Header'
import DemoPageLinks from '../components/DemoPageLinks'
import { getApp } from 'firebase/app'
import { getFirestore, collection, onSnapshot } from 'firebase/firestore'
const styles = {
content: {
padding: 32,
},
infoTextContainer: {
marginBottom: 32,
},
}
const Demo = () => {
const user = useUser()
return (
<div>
<Header email={user.email} signOut={user.signOut} />
<div style={styles.content}>
<div style={styles.infoTextContainer}>
<h3>Home</h3>
<p>
This page does not require authentication, so it won't redirect to
the login page if you are not signed in.
</p>
<p>
If you remove `getServerSideProps` from this page, it will be static
and load the authed user only on the client side.
</p>
</div>
<DemoPageLinks />
</div>
</div>
)
}
export const getServerSideProps = withUserTokenSSR()(() => {
onSnapshot(collection(getFirestore(getApp()), 'artists'), (snap) => {
if (!snap) {
return;
}
console.log(snap);
});
})
export default withUser()(Demo)
Describe the bug
I'm not sure if I'm doing something wrong here, or if this is indeed a bug, but according to https://stackoverflow.com/a/71119461 it should be possible to use the normal client SDK for
getServerSideProps
. However, when I try to do so and follow the instructions in https://github.com/gladly-team/next-firebase-auth/blob/v1.x/EXAMPLES.md#using-the-firebase-apps, I always get the following error:Minimal code example for the
index.js
(I can also provide a repo for this if it helps):Versions
next-firebase-auth
version: 1.0.1Firebase JS SDK (
firebase
): 9.16.0Firebase admin SDK (
firebase-admin
): 11.19.0Next.js: 14.0.3
The text was updated successfully, but these errors were encountered: