Skip to content
Back

Error 500 when using queries (node-sdk w/ Sveltekit)

  • 0
  • Self Hosted
  • Databases
  • Web
one_juru
22 Feb, 2024, 13:54

Hey y'all, I really hope you can help me with the following issue, I tried for about 2 hours but I just can't get it to work.

I'm currently building a SvelteKit site with SSR and I'm trying to use the node-appwrite package to make some server-side request to my Appwrite database. If I don't include any queries the request returns the first 25 results (as expected), but as soon as I try to use any query-pramter (eg. equal, limit, offset) the query just return the following response:

TypeScript
{
  code: 500,
  type: 'general_unknown',
  response: {
    message: 'Server Error',
    code: 500,
    type: 'general_unknown',
    version: '1.4.13'
  }
}

Since I'm selfhosting Appwrite, I also took a look at the error that popped up on the server (because error 500 suggests a server-error to me):

TypeScript
appwrite                      | [Error] Timestamp: 2024-02-22T13:51:33+00:00
appwrite                      | [Error] Method: GET
appwrite                      | [Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents
appwrite                      | [Error] Type: Utopia\Database\Exception\Query
appwrite                      | [Error] Message: Invalid query: {"method":"limit","values":[10]}
appwrite                      | [Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Query.php
appwrite                      | [Error] Line: 825

The part that confuses me the most, is that regular HTTP-querries are in fact still working (just tested the exact same query that failed with the sdk successfully). i could skip using the sdk and write regular fetch requests myself with axios but I'd prefer using the sdk if anyone knows what's up and how to fix this.

Thank you for your time :)

TL;DR
Issue: Error 500 occurs when using queries with node-sdk in SvelteKit. The server response indicates a general unknown error. Solution: The error appears to be due to an invalid query format. Check the query syntax being sent to Appwrite using the node-appwrite package. Regular HTTP queries work, suggesting a possible issue with the SDK's query construction. Consider revising the query parameters to match Appwrite's expected format for queries.
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