Back

Invalid query error

  • 0
  • Functions
  • Cloud
Chandan Gowda
1 Apr, 2024, 10:14

Traceback (most recent call last): File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/client.py", line 114, in call response.raise_for_status() File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://cloud.appwrite.io/v1/databases/654232d47fca4f8eea13/collections/654237ac94a04109aabc/documents?queries%5B0%5D=%7B%22method%22%3A%22equal%22%2C%22attribute%22%3A%22question_id%22%2C%22values%22%3A%5B%22660a314e0033fdc12378%22%5D%7D&queries%5B1%5D=%7B%22method%22%3A%22equal%22%2C%22attribute%22%3A%22option%22%2C%22values%22%3A%5B3%5D%7D&queries%5B2%5D=%7B%22method%22%3A%22orderAsc%22%2C%22attribute%22%3A%22%24createdAt%22%7D&queries%5B3%5D=%7B%22method%22%3A%22limit%22%2C%22values%22%3A%5B13%5D%7D

TL;DR
Developers are facing an "Invalid query" error while trying to list documents. The error is due to a specific query method for attribute "question_id" that is causing a bad request HTTP error. The issue seems to be with the query structure. The query values need to be adjusted to correct the error.
Chandan Gowda
1 Apr, 2024, 10:15

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/server/src/server.py", line 163, in action output = await asyncio.wait_for(execute(context), timeout=safeTimeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for return fut.result() File "/usr/local/server/src/server.py", line 156, in execute output = userModule.main(context) File "/usr/local/server/src/function/src/main.py", line 101, in main submissionsRef = database.list_documents(MASTER_DATABASE_ID, SUBMISSION_COLLECTION_ID, queries = [Query.equal("question_id", [questionDoc["$id"]]), Query.equal("option",[correct_option]), Query.order_asc("$createdAt"), Query.limit(13)]) File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/services/databases.py", line 916, in list_documents return self.client.call('get', api_path, { File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/client.py", line 129, in call raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json()) appwrite.exception.AppwriteException: Invalid query: {"method":"equal","attribute":"question_id","values":["660a314e0033fdc12378"]}

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