Skip to content
Back

Appwrite functions can't connect to database - timeout issues

  • 0
  • Self Hosted
  • Functions
Jerrold
4 Jul, 2025, 04:58

I'm trying to create a function that queries my database, but all database operations timeout from within the function, even though CLI access works perfectly.

I'm self-hosted at this time running node-16.0 and the node-appwrite SDK.

What Works:

  • The CLI databaase access works fine (appwrite databases list-documents succeeds)
  • Function executes and can import node-appwrite
  • API key has proper permissions (database.read, documents.read, etc)

What Fails:

  • ANY database operation from within function times out (even databases.list())
  • Both localhost and 192.168.1.126 endpoints fail
  • Timeouts occur within 3-5 seconds.

This works: appwrite databases list-documents --database-id xxx --collection-id yyy This fails: const result = await databases.listDocuments(databaseId, collectionId, []);

I've tested that the function runtime works, SDK imports correctly, and API keys have permissions. The issue is specifically with network connectivity from function to database.

Any thoughts on what I might be doing wrong? Are there any examples of this type of an operation available?

Thanks

TL;DR
Appwrite function can't perform database operations due to timeout issues. CLI access to the database works fine. The function has proper permissions and runtime. However, all database operations within the function timeout within 3-5 seconds. The issue seems to be with network connectivity from the function to the database.
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