SimCoderYoutube / InstagramClone

Instagram Clone React Native Tutorial 2021 👨‍💻 I'll show you how you can do this in the simplest way and terms possible. By the end of this series you'll have learned how the big companies do it and will be able to do the same, you not only will be able to do this app, but you'll be able to put what you learn into your very own projects! In this series, we use React Native with Expo to quickly deploy the project. We use firebase for all our microservice needs like the auth system, database, storage, amongst others. firebase, redux, react native, javascript, expo. In this series, we'll use all of them and you'll learn them by doing an iconic app. Welcome to this Simcoder project and make an Instagram Clone!
Apache License 2.0
745 stars 294 forks source link

Unhandled Rejection: snapshot.query.EP is undefined #22

Open Yeghishe-Karapetyan opened 3 years ago

Yeghishe-Karapetyan commented 3 years ago

I've been following the tutorial and got this error

SimCoderYoutube commented 3 years ago

Hi!

Could you please let me know which version of firebase and expo you are currently using?

Yeghishe-Karapetyan commented 3 years ago

{ "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web", "eject": "expo eject" }, "dependencies": { "@react-native-community/masked-view": "0.1.10", "@react-navigation/bottom-tabs": "^5.11.8", "@react-navigation/material-bottom-tabs": "^5.3.14", "@react-navigation/native": "^5.9.3", "@react-navigation/stack": "^5.14.3", "expo": "~40.0.0", "expo-camera": "^10.0.0", "expo-image-picker": "^10.0.0", "expo-status-bar": "~1.0.3", "firebase": "^8.2.9", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz", "react-native-gesture-handler": "~1.8.0", "react-native-paper": "^4.7.2", "react-native-reanimated": "~1.13.0", "react-native-safe-area-context": "3.1.9", "react-native-screens": "~2.15.2", "react-native-vector-icons": "^8.1.0", "react-native-web": "~0.13.12", "react-redux": "^7.2.2", "redux": "^4.0.5", "redux-thunk": "^2.3.0" }, "devDependencies": { "@babel/core": "~7.9.0" }, "private": true }

Yeghishe-Karapetyan commented 3 years ago

I sent it

Yeghishe-Karapetyan commented 3 years ago

How to solve this??

cerovcecblaze commented 3 years ago

A potential solution is to use:

const uid = snapshot.docs[0].ref.path.split('/')[1];

and put that line^ and the rest of the code in that function in a try catch block. The line above will throw an error if there is no documents (posts), so for users where this throws an error, just catch, and do nothing since its pointless to get the posts of a user with no posts.

minhquan0902 commented 3 years ago

I think you should console.log(snapshot) for yourself and try to find the segments data based on the console.log, the snapshot data might be different because firebase might update their way to display the snapshot. For my part i was able to retrieve the data from snapshot..query.C.path.segments[1];

brainexe03 commented 3 years ago

I think you should console.log(snapshot) for yourself and try to find the segments data based on the console.log, the snapshot data might be different because firebase might update their way to display the snapshot. For my part i was able to retrieve the data from snapshot..query.C.path.segments[1];

I keep getting the Path error with this too.

cliadaa commented 3 years ago

I'm facing the same issue when fetching userlikes (((snapshot.ZE.path.segments[3];))))), any solutions???

SanyamPunia commented 2 years ago

I fixed my uid issue by logging the snapshot value in console. My tree was alot different from the one sim had!

const uid = snapshot._delegate.query._query.T.path.segments[1];

image psd

SimonCariou commented 2 years ago

I've got something like that which works fine for me: const uid = snapshot.query._path.segments[1]

image

hoping the response doesn't change in the future...

foysalremon commented 2 years ago

I had the same issue and solved it for now with snapshot._.query.C_.path.segments[1]. But not sure if is this the proper solution cause @SimCoderYoutube, you don't describe about this that much. Please describe more about this