Back

[SOLVED] GraphQL Explorer not connecting to collection on localhost

  • 0
  • Self Hosted
  • Accounts
  • Databases
  • Web
Drake
22 Feb, 2023, 01:23

The docs (https://appwrite.io/docs/server/databases?sdk=graphql-default#databasesListCollections) have this:

TypeScript
query {
    databasesListCollections(
        databaseId: "[DATABASE_ID]"
    ) {
        total
        collections {
            _id
            _createdAt
            _updatedAt
            _permissions
            databaseId
            name
            enabled
            documentSecurity
            attributes
            indexes {
                key
                type
                status
                attributes
            }
        }
    }
}

so you might want to start with that

TL;DR
Issue: GraphQL Explorer not connecting to collection on localhost Solution: - Check if the query is valid, as indicated by red underlines on attributes and index. - Make sure to fill in the appropriate values for project and key. - Open the variables pane at the bottom left of the screen. - Access the Appwrite console using the correct URL. - Verify that the headers being used are correct. - If a "something is broken" message pops up, check the list documents API call or the list collections API call. - Remove the "attributes" field from the query to test an API call. - Refer to the documentation for
Drake
22 Feb, 2023, 01:24

and then the explorer gives a warning about attributes so you can remove it to quickly test an API call

truth
22 Feb, 2023, 01:26

do i need to reference a collection or do queries search across all collections in a database?

Drake
22 Feb, 2023, 01:27

What do you mean? this API call is list collections...it lists all the collections in a database

Drake
22 Feb, 2023, 01:29

list documents will give you the documents in a collection: https://appwrite.io/docs/server/databases?sdk=graphql-default#databasesListDocuments

truth
22 Feb, 2023, 01:31
truth
22 Feb, 2023, 01:31

sometimes a message pops up and says "something is broken"

truth
22 Feb, 2023, 01:31
Drake
22 Feb, 2023, 01:32

no these are not the right headers. see the list of headers here: https://appwrite.io/docs/rest#headers

truth
22 Feb, 2023, 01:32

oohhh..

Drake
22 Feb, 2023, 01:33

and you never answered how you're accessing the Appwrite console. What's the URL you use to access your Appwrite console?

truth
22 Feb, 2023, 01:33
Drake
22 Feb, 2023, 01:34

this error says something about file variables...can you open the variables pane at the bottom left of the screenshot you shared?

truth
22 Feb, 2023, 01:36

variables is empty

Drake
22 Feb, 2023, 01:36

how about files at the bottom of the variables pane

truth
22 Feb, 2023, 01:38

0 files

truth
22 Feb, 2023, 01:38
Drake
22 Feb, 2023, 01:40

what exactly shows there?

Drake
22 Feb, 2023, 01:43

sure...make sure to fill in the appropriate values, though

truth
22 Feb, 2023, 01:58

they are filled

Drake
22 Feb, 2023, 02:00

There you go. and the explorer can help give you hints about what's wrong with the query

truth
22 Feb, 2023, 02:00

interesting though i got this error whether or not i had the project and key filled out

Drake
22 Feb, 2023, 02:01

yes because the query itself is invalied. you can see attributes and index have a red underline in the query

truth
27 Feb, 2023, 22:02

I can connect thank you

Drake
27 Feb, 2023, 22:02

[SOLVED] GraphQL Explorer not connecting to collection on localhost

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