Open
Description
Description
In iOS the app often crashes when I try to save something in the Amplify DataStore. I couldn't find a reliable pattern to reproduce the issue, but I see the following error logged in Sentry:
NSInvalidArgumentException InternalFlutterGpu_Texture_AsImage - Invalid number value (NaN) in JSON write
I could not reproduce this problem in debug mode—it seems only happen in release builds and makes my app unusable. Howerver I'm sure that it has to do with the amplify library because if I remove it from the app, no crashes appear.
In the following the crashlog (crashlog.txt):
Last Exception Backtrace:
0 CoreFoundation 0x1a7d9cf20 __exceptionPreprocess + 164 (NSException.m:249)
1 libobjc.A.dylib 0x19fc4b2b8 objc_exception_throw + 60 (objc-exception.mm:356)
2 Foundation 0x1a6c043e4 _writeJSONNumber + 1084 (NSJSONSerialization.m:0)
3 Foundation 0x1a6c02f68 ___writeJSONObject_block_invoke + 388 (NSJSONSerialization.m:588)
4 libswiftCore.dylib 0x1a6988bac specialized _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:) + 652 (DictionaryBridging.swift:365)
5 libswiftCore.dylib 0x1a6704ae0 @objc _SwiftDeferredNSDictionary.enumerateKeysAndObjects(options:using:) + 48 (<compiler-generated>:349)
6 Foundation 0x1a6c03c08 _writeJSONObject + 516 (NSJSONSerialization.m:680)
7 Foundation 0x1a6be5288 -[_NSJSONWriter dataWithRootObject:options:] + 96 (NSJSONSerialization.m:385)
8 Foundation 0x1a6be5114 +[NSJSONSerialization dataWithJSONObject:options:error:] + 112 (NSJSONSerialization.m:3204)
9 *****Prod 0x100dbcfa0 static FlutterDataStoreRequestUtils.getJSONValue(_:) + 88 (FlutterDataStoreRequestUtils.swift:8)
10 *****Prod 0x100dbcfa0 specialized SwiftAmplifyDataStorePlugin.onSave(args:flutterResult:) + 2024 (SwiftAmplifyDataStorePlugin.swift:452)
11 *****Prod 0x100daf5ec specialized SwiftAmplifyDataStorePlugin.onSave(args:flutterResult:) + 20 (AtomicResult.swift:224)
12 *****Prod 0x100daf5ec implicit closure #1 in AtomicResult(_:_:) + 20 (AtomicResult.swift:11)
13 *****Prod 0x100daf5ec AtomicResult(_:_:) + 20 (<compiler-generated>:0)
14 *****Prod 0x100daf5ec SwiftAmplifyDataStorePlugin.handle(_:result:) + 1988
15 *****Prod 0x100dafa88 @objc SwiftAmplifyDataStorePlugin.handle(_:result:) + 108 (<compiler-generated>:0)
16 Flutter 0x103a620e8 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 164 (FlutterChannels.mm:313)
17 Flutter 0x1034e6be0 invocation function for block in flutter::PlatformMessageHandlerIos::HandlePlatformMessage(std::_fl::unique_ptr<flutter::PlatformMessage, std::_fl::default_delete<flutter::PlatformMessage>>) + 116 (platform_message_handler_ios.mm:70)
18 libdispatch.dylib 0x1afc4113c _dispatch_call_block_and_release + 32 (init.c:1530)
19 libdispatch.dylib 0x1afc42dd4 _dispatch_client_callout + 20 (object.m:576)
20 libdispatch.dylib 0x1afc515a4 _dispatch_main_queue_drain + 988 (queue.c:7898)
21 libdispatch.dylib 0x1afc511b8 _dispatch_main_queue_callback_4CF + 44 (queue.c:8058)
22 CoreFoundation 0x1a7d6f710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
23 CoreFoundation 0x1a7d6c914 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
24 CoreFoundation 0x1a7d6bcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
25 GraphicsServices 0x1ec7b91a8 GSEventRunModal + 164 (GSEvent.c:2196)
26 UIKitCore 0x1aa3a5ae8 -[UIApplication _run] + 888 (UIApplication.m:3713)
27 UIKitCore 0x1aa459d98 UIApplicationMain + 340 (UIApplication.m:5303)
28 UIKitCore 0x1aa5d3504 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:539)
29 *****Prod 0x1009cc728 specialized static UIApplicationDelegate.main() + 28 (<compiler-generated>:4)
30 *****Prod 0x1009cc728 static AppDelegate.$main() + 28 (AppDelegate.swift:0)
31 *****Prod 0x1009cc728 main + 120
32 dyld 0x1cb543154 start + 2356 (dyldMain.cpp:1298)
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
I cannot find a pattern that reproduce this problem but it appears whenever the app saves elements in the datastore with a high frequency
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.27.2
Amplify Flutter Version
2.6.0
Deployment Method
Amplify CLI (Gen 1)