rudderlabs / rudder-sdk-flutter

Flutter SDK for RudderStack - the Customer Data Platform for Developers. Now supports Android, iOS and Web tracking!
https://www.rudderstack.com
Other
7 stars 25 forks source link

BUG : "RSDBPersistentManager: saveEvent: SQLite Command Preparation Failed" on iOS SDK 14 #132

Closed cheyne-rr closed 1 year ago

cheyne-rr commented 1 year ago

Describe the bug

We are running into an issue where all events are not being fired for iOS devices with iOS SDK 14, after updating to the latest iOS/Flutter SDKs. Events fire fine on iOS SDKs >= 15.

I am able to repro this on a iOS 14.5 simulator, and looking at the logs I see: [logging] near "RETURNING": syntax error in "INSERT INTO events (message, updated) VALUES ([redacted]) RETURNING id;"

And debugging into the Rudder SDK I am seeing us hit the error in RSDBPersistentManager.m: @"RSDBPersistentManager: saveEvent: SQLite Command Preparation Failed"

I see these just on iOS 14 with these new SDKs, I assume they are relevant to the events not showing up on the backend.

I am seeing this when I update our Flutter SDKs rudder_sdk_flutter: ^2.3.0 -> ^2.5.1 rudder_sdk_flutter_platform_interface: ^2.3.0 -> ^2.5.0

but I'm guessing the real reason is the native iOS SDK being updated: Rudder (1.19.2) -> (1.20.0)

I have seen some noise in commits recently concerning db encryption issues recently which may be relevant?

Here is an example stack where I am hitting the saveEvent error:

0 0x000000010309f1a0 in -[RSDBPersistentManager saveEvent:] at .../ios/Pods/Rudder/Sources/Classes/RSDBPersistentManager.m:334

1 0x00000001030afbdc in -[RSEventRepository dump:] at .../ios/Pods/Rudder/Sources/Classes/RSEventRepository.m:242

2 0x00000001030924f0 in -[RSClient dumpInternal:type:] at .../ios/Pods/Rudder/Sources/Classes/RSClient.m:75

3 0x00000001030927d0 in -[RSClient track:properties:] at .../ios/Pods/Rudder/Sources/Classes/RSClient.m:105

4 0x0000000103090a70 in -[RSApplicationLifeCycleManager sendApplicationOpenedWithProperties:] at .../ios/Pods/Rudder/Sources/Classes/RSApplicationLifeCycleManager.m:152

5 0x00000001030909a8 in -[RSApplicationLifeCycleManager sendApplicationOpenedOnLaunch:withVersion:] at .../ios/Pods/Rudder/Sources/Classes/RSApplicationLifeCycleManager.m:147

6 0x0000000103090548 in -[RSApplicationLifeCycleManager applicationDidFinishLaunchingWithOptions:] at .../ios/Pods/Rudder/Sources/Classes/RSApplicationLifeCycleManager.m:110

7 0x0000000103090010 in -[RSApplicationLifeCycleManager handleAppStateNotification:] at .../ios/Pods/Rudder/Sources/Classes/RSApplicationLifeCycleManager.m:44

Which platform is the issue occurring on

Expected behavior Events to fire on iOS SDK 14

To Reproduce Steps to reproduce the behaviour:

  1. Initialise latest Flutter SDK on iOS 14.5 simulator
  2. Make events '....'
  3. See the error

Version of the Flutter SDK rudder_sdk_flutter: ^2.5.1 rudder_sdk_flutter_platform_interface: ^2.5.0 Rudder: (1.20.0)

Framework version of the SDK Flutter Doctor output [✓] Flutter (Channel stable, 3.13.3, on macOS 13.5.2 22G91 darwin-arm64, locale en-US) [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] VS Code (version 1.82.2) [✓] Connected device (5 available) [✓] Network resources

Check for Correct Usage of writeKey and dataPlaneUrl I have confirmed that the correct writeKey and dataPlaneUrl are utilized during SDK initialization; they work on other platforms and previous SDKs

desusai7 commented 1 year ago

Hey @cheyne-rr,

Thank you for reporting this issue, we are looking into this right now.

desusai7 commented 1 year ago

Hey @cheyne-rr,

We are working on fixing this issue, we will have it release tomorrow

cheyne-rr commented 1 year ago

Great, quick turnaround! Many thanks!

desusai7 commented 1 year ago

Hey @cheyne-rr,

Can you try upgrading to the version 1.22.0 of the Rudder and let us know if this issue is resolved ?

cheyne-rr commented 1 year ago

Hey @desusai7,

Thank you team for the quick fix! I've verified that this has fixed themy issue on the iOS 14.5 Simulator. I'm am awaiting signal that this is fixed on device (I expect it is), I should have that tomorrow; I'll update this thread when verified.

cheyne-rr commented 1 year ago

Hey, confirming that this has fixed our issue on iOS SDK 14 devices as well. Thank you!

desusai7 commented 1 year ago

Awesome, great to hear that.