Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'uid')

I am trying to get list of pets that owned by current.user.uid but I am facing issues with the backend code. The error stated

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'uid')


This my script

enter code here<script>

 // @ is an alias to /src
import getUser from "@/composables/getUser"
import { auth, db } from "@/firebase/config";
import {signOut} from "firebase/auth";
import { collection, onSnapshot, query, where  } from '@firebase/firestore';

export default {
 name: 'HomeView',
 setup(){

  const {user} = getUser()
  const router = useRouter()
  const q = query(collection(db,"pets"),where("UserID", "==", user.value.uid));
  const unsubscribe = onSnapshot(q,(querySnapshot)=>{
  const pet = [];
  querySnapshot.forEach((doc)=> {
    pet.push(...doc.data())
  });
  console.log("Current pets :", pet.join(","))
 })

  return {q, unsubscribe ,error}
 }
}

firebase diagram


So, actually i want the document that have the current uid display in the list thanks for helping me

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!