Skip to content
Sites Hackathon is live / Aug 29 - Sep 12
Back

Can't connect to database/table

  • 0
  • React Native
nevagivup
29 Aug, 2025, 11:22

Hi, I follow a tutorial here https://www.youtube.com/watch?v=YSUmzHH_OMg but cannot connect to my personal database using this method:

const {documents, total} = await database.listDocuments(databaseId,tableId);

The listDocuments method is crossed over and deprecated, in fact all methods in that database object are deprecated. Database is initiated by:

import {Client, Databases} from 'react-native-appwrite'; import { Platform } from 'react-native';

const client = new Client();

client .setEndpoint('https://fra.cloud.appwrite.io/v1') .setProject(myProjectId);

switch (Platform.OS) { case 'ios': client.setPlatform('com.example.test'); break; case 'android': client.setPlatform('com.example.test'); break; default: break; }

const database = new Databases(client);

export {client, database};

When I start expo, the table row is not returned into the app

TL;DR
Developers having trouble connecting to a database/table due to authentication issues receiving 401 Unauthorized error. The React Native SDK documentation is insufficient, and tutorials are confusing mentioning collections instead of tables. The issue arises from deprecated methods in the database object, including listDocuments. Offer the solution to update code using the latest SDK methods provided in the React Native SDK documentation.
nevagivup
29 Aug, 2025, 11:23

by the way I keep seeing tutorial mentioning collection, but I don't have a collection, only table, I assume they are the same, still, quite confusing

Axistro
29 Aug, 2025, 11:28

The changes were made a few days ago

nevagivup
29 Aug, 2025, 11:30

Does it also requite some kind of authentication for this call now? It now seems to try to connect but I got 401 Unauthorized back.

if possible can you point me to the latest documentation for React Native SDK? I find this severly lacking.

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