Skip to content
Back

Angular: AppwriteException: Database not found

  • 0
  • Web
  • Cloud
AngryAnt
18 Feb, 2025, 10:17

I have a database & collection pair set up with the database ID "Data" and the collection ID "Collection". They are set up with All users granted all access rights to the collection.

Database and collection are created & configured by a backend application (via the .net API). This application is able to create new documents in the collection just fine. However when the Angular-based client attempts to do so, it is met with the exception "AppwriteException: Database not found". This same client can see the documents created by the backend just fine, via a realtime subscription.

The frontend is registered on the (cloud.appwrite.io) dashboard as a web client with hostname set to "localhost" as I am just testing & developing locally for now.

The typescript attempting to create the document in the client is as follows:

TypeScript
  async sendMessage (message: string)
  {
    this.error = null;

    try
    {
      await databases.createDocument (
        'Data',
        'Collection',
        ID.unique (),
        {
          sender: this.username,
          contents: message
        }
      );
    }
    catch (error)
    {
      this.error = error;
    }
  }

Any idea what could be causing the error? Common pitfalls I should look out for?

TL;DR
Developers experiencing 'AppwriteException: Database not found' when attempting to create a document in an Appwrite collection via Angular frontend. Backend successfully creates documents. Frontend uses correct database & collection IDs, granted access rights, and real-time subscription works. Frontend registered as a web client with hostname set to 'localhost'. Solution: Confirm correct database & collection IDs used in frontend method `createDocument()`. Check proper setup of Angular appwrite SDK. Verify correct frontend permissions and API key setup. Double-check app configuration and permissions on the Appwrite dashboard.
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