Back

Database not found when attempting to ListDocuments (or any document method) without API key

  • 0
  • Databases
  • REST API
  • Cloud
Pingu
7 Dec, 2024, 09:35

So, I am doing this in postman to eliminate any possible weirdness from my SDK, and still unable to hit any document level endpoint for my database.

I am trying to list documents, for example. I am sending a GET to https://cloud.appwrite.io/v1/databases/6748b44d000b2b0e73ac/collections/6748bb30002a12d4708f/documents, with the project ID set in the headers. When I also send through the API key, I get the results that I would expect. However, when I don't send the API key (so acting as a guest) I get the following response:

TypeScript
{
    "message": "Database not found",
    "code": 404,
    "type": "database_not_found",
    "version": "1.6.1"
}

I have also tried sending an authenticated user as the Session header, and I also get the same response.

Now, the collection has the permissions shown in the attached image, however I have tried with a variety of permissions and have never had it work. I don't think the issue lies there however, as I would expect to see instead an error relating to the collection, not the database.

The database ID is 100% correct, as the exact same URL works correctly when I provide the API key.

Totally lost with this right now, sorry.

TL;DR
Developers experiencing issues with accessing documents in a database without an API key. Even when the correct database and collection permissions are set, receiving a "Database not found" error. The solution involves providing the API key for authentication to access the documents successfully.
Eldad
7 Dec, 2024, 09:39

Are you using collection level or document level permissions?

Pingu
7 Dec, 2024, 09:40

I hav tried with document security turned both on and off, and whilst on have provided similar permissions to the only document within the collection also.

Pingu
7 Dec, 2024, 09:40
Pingu
7 Dec, 2024, 09:51

Have deleted the database, created a new one and a new collection, and it appears to be working with this.

Pingu
7 Dec, 2024, 09:51

I have an identical setup as before

Pingu
7 Dec, 2024, 09:52

Pretty concerning that database can be put into a state where it becomes inaccessible to the client like that. Is this related to the weird issues recently where the API key got removed etc?

Eldad
7 Dec, 2024, 09:54

We haven't see any similar issues like that which I'm aware of. What caused this to start happening for you? I you'll share your project ID, I can let the team check and see if they notice any specific issues.

Pingu
7 Dec, 2024, 09:55

Honestly, I'm not sure. Its a project I am using for test purposes to build a dot net SDK, hence trying thigns in postman etc.

Project ID is 6649523d000d7884ae74

Pingu
7 Dec, 2024, 09:57

A few days ago, my master API key that I had created and been using for a while (which has no expiry) stopped working. When viewing it in console, it just reported back as "false".

I've still got it there, so it can still be seen. Have been using a new API key in the meantime. When viewing the api Key, it looks like this. This was the first time I noticed any sort of weirdness...

Pingu
7 Dec, 2024, 09:58

On the same day, I also had my console account go through weird issue, I was on a page in console, navigated to antoher page in console and got logged out. Tried to log back in but my password didn't seem to work any longer, so I had to reset it before it would let me back in.

Eldad
7 Dec, 2024, 09:59

Got it, thanks for sharing the ID. Let me check with the team and see if this is something of concern. We'll also monitor for any other similar issues, but I'm not aware of such for now.

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