I am currently developing an app for an NGO using NextJS and firebase as the primary database. While working on my project, I encountered a concerning issue.
import {
collection,
where,
query,
getDocs
} from '@firebase/firestore';
import { db } from '../../../services/firebase';
export async function getServerSideProps({query}) {
const user = await getDocs(query(collection(db, 'members'), where('id', '==', query)))
return {
props: {
// VisionInfo: JSON.stringify(user.docs.map(item => item.data()))
json: JSON.stringify('Hello')
}
};
}
In NextJS, when using serverSideProps to fetch Query parameters from the URL, the keyword "query" is necessary. However, this clashes with the same keyword used to fetch firebase documents, resulting in the error message "query is not a function". Is there any workaround to access Query within serverSideProps?