appwrite / appwrite/sdk-for-apple

🐛 Bug Report: Realtime Error Invalid query: Syntax error

Open
#117 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
123
Forks
37
Avg merge
2h 50m
Merged PRs (30d)
1

Description

### 👟 Reproduction steps

I was test driving Self-Hosted Appwrite for my use with Swift IOS apps as a backend while back and after successful trials, I started to move to incorporate into my actual apps. I setup Realtime for TablesDB updates and everything was working great in my test app. When I finally moved to incorporating, Realtime stopped working.

Not sure if this issue is related to Self-Host being far behind on updates (currently sitting at 1.9.0 when latest SDKs want 1.9.5). Due to the version mismatch, I downgraded my SDK-Apple version to 16.0.0, but found out Realtime no longer worked.

So I started doing incremental steps back to find out where it broke for me. I was able to determine that the break happens between 14.0.0 and 14.1.0.

I am subscribing to realtime as follows to trigger my function for any table update per the [Realtime Channels Documentation](https://appwrite.io/docs/apis/realtime/channels):

`subscription = try? await realTime.subscribe( channels: [ Channel.rows() ]) { response in Task { try? await self.processRealtimeResponse(response) } }`

This works in 14.0.0, but in 14.1.0+ I get the following errors in the appwrite-realtime log:

> [Error] Type: Appwrite\Extend\Exception
> [Error] Message: Invalid query: Syntax error
> [Error] File: /usr/src/code/app/realtime.php
> [Error] Line: 716

Initially I thought it had to do with queries that was added at 14.1.0, but I am not using the realtime queries feature. When looking at server realtime.php cited above, it appears the line is separate from the Realtime queries feature and just a generic error for malformed realtime queries on the server.

I even tried capturing the subscribe code above in a do->catch instead of try? and no error is thrown on my iOS side. In fact if I do a test output after the above, iOS appears to report it as assigned:

`print("subscription: \(subscription.debugDescription)")`
`print("realTime: \(realTime)")`

> subscription: Optional(Appwrite.RealtimeSubscription)
> realTime: Appwrite.Realtime

### 👍 Expected behavior

I should get Realtime responses as expected as with 14.0.0.

### 👎 Actual Behavior

Error occurs as shown above and no realtime responses are received.

### 🎲 Appwrite version

Different version (specify in environment)

### 💻 Operating system

Linux

### 🧱 Your Environment

Self-host 1.9.0 on Debian Trixie.

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start by comparing the SDK-Apple 14.0.0 and 14.1.0 subscription behavior for `Channel.rows()` against the Realtime Channels documentation. Reproduce with Self-host 1.9.0 on Debian Trixie and inspect the `realtime.php` error at line 716. Done means the subscription receives Realtime responses on 14.1.0 or later without the syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
api, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.