Hey! i got a python function. it works locally. but whenever i try to run it on the server, i basically get this error:
appwrite.exception.AppwriteException: Invalid query: Syntax error```
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 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://appwrite.addix.campus/v1/databases/66b9be530000f859054e/collections/66b9becc002ef33bd228/documents?queries%5B0%5D=equal%28%22hasPDF%22%2C+false%29
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 148, in execute
userModule = importlib.import_module("function." + userPath)
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/local/server/src/function/entrypoint.py", line 2, in <module>
from . import generatePDF
File "/usr/local/server/src/function/generatePDF.py", line 11, in <module>
result = getdata.getServicescheinewithoutPDF()
File "/usr/local/server/src/function/getdata.py", line 25, in getServicescheinewithoutPDF
result = databases.list_documents(
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 134, in call
raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json())
appwrite.exception.AppwriteException: Invalid query: Syntax error
no logs except in appwrite:
[Error] Timestamp: 2024-09-02T07:08:35+00:00
[Error] Method: GET
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
[Error] Type: Utopia\Database\Exception\Query
[Error] Message: Invalid query: Syntax error
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Query.php
[Error] Line: 225
i thiink it might have to do with how its interpreted? although i dont really see the error since it runs on my machine fine.
def getServicescheinewithoutPDF():
try:
query = 'equal("hasPDF", false)'
print(f"Query: {query}")
result = databases.list_documents(
database_id="66b9be530000f859054e",
collection_id="66b9becc002ef33bd228",
queries=[query]
)
print(f"Result: {result}")
return result
except Exception as e:
print(f"An error occurred: {e}")
raise```
this is the function i have
and hasPDF definitely exists...
Recommended threads
- TOO_MANY_REDIRECTS after temporarily ena...
I am losing my mind over this, I enabled this setting because I was having issues with sites not making links with https. I enabled it, ran into issues, so I di...
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I canβt fin...
- Triggers and call function in function p...
Hello, Today we are experiencing several issues with Appwrite Cloud. Functions triggered by events, or functions called from another function, are taking an e...