Back

Cannot read prototype of undefined

  • 0
  • Web
Illusionist
1 Oct, 2023, 19:24

I am trying to start using appwrite with react-native but getting This error 'Cannot read prototype of undefined' from Client. After setEndpoint I am setting project ID.

TL;DR
Issue: The user is receiving an error message stating "Cannot read prototype of undefined" when trying to use the Client in their React Native app with the Appwrite SDK. Possible Solution: It seems that the user is using the wrong SDK. They should be using the Web SDK instead of the Node SDK for a React Native app. They should switch to the Web SDK and make sure to import the Client after the import statement.
D5
1 Oct, 2023, 19:27

Try putting client just after the import statement

Illusionist
1 Oct, 2023, 19:29
Illusionist
1 Oct, 2023, 19:29

Still same error.

D5
1 Oct, 2023, 19:31

What's the SDK you're using?

D5
1 Oct, 2023, 19:31

Node SDK or web SDK?

Illusionist
1 Oct, 2023, 19:32

Node 18.17.1 appwrite sdk ^13.0.0

D5
1 Oct, 2023, 19:33

This is a react native app?

Illusionist
1 Oct, 2023, 19:34

Yes.

D5
1 Oct, 2023, 19:34

Then you should not use node, instead web SDK

Illusionist
1 Oct, 2023, 19:35

I didn't understand. What do you mean by I should not use node. Node is required for react native.

D5
1 Oct, 2023, 19:45

There are 2 appwrite SDK:

  • Node SDK
  • Web SDK

I think you're using the first one, so use the second one for react

Illusionist
1 Oct, 2023, 19:45

Ohh sorry. I am using webSDK only.

Drake
1 Oct, 2023, 23:52

Is there a stack trace?

Illusionist
2 Oct, 2023, 16:51

yes. there is

Illusionist
2 Oct, 2023, 16:52

Issue can be reproduced by cloning this repo and in dev branch replace Project Endpoint and ID in loginUser function inside Login.tsx

Illusionist
2 Oct, 2023, 16:52
Illusionist
3 Oct, 2023, 14:16

Pinging this to bring it to the top.

Drake
3 Oct, 2023, 18:10

sorry i tried running this but i got errors running on android and ios. for android it was something about source.properties and for ios it was

TypeScript
error: Unable to load contents of file list: '/Target Support Files/Pods-appwrite/Pods-appwrite-resources-Debug-input-files.xcfilelist' (in target 'appwrite' from project 'appwrite')
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more