stream-feed-flutter icon indicating copy to clipboard operation
stream-feed-flutter copied to clipboard

Type mismatch crash at SDK on timeout error

Open sharansingh00002 opened this issue 4 years ago • 1 comments

Describe the bug When fetching feed using SDK, In case of timeout error there is a type mismatch crash at SDK side, instead of getting the timeout error logs through the SDK we are getting type mismatch error.

What version of Flutter do you use? 2.5.3

What package are you using? What version? 0.5.0

What platform is it about?

  • [ Y] Android
  • [ Y] iOS
  • [ ] Web
  • [ ] Windows
  • [ ] MacOS
  • [ ] Linux

To Reproduce Steps to reproduce the behavior:

  1. Set the timeout value in SDK to some less value like 5 sec
  2. Fetch feed using SDK
  3. See error

Expected behavior

I/flutter (20724): (2022-02-18 13:10:38.274839) 🚨 📜 ╔╣ DioError ║ DioErrorType.connectTimeout
I/flutter (20724): (2022-02-18 13:10:38.275134) 🚨 📜 ║  Connecting timed out [1000ms]
I/flutter (20724): (2022-02-18 13:10:38.275303) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (20724): (2022-02-18 13:10:38.275737) 🚨 📜 
I/flutter (20724): (2022-02-18 13:10:38.275910) 🚨 📜 ╔╣ Request ║ GET 
I/flutter (20724): (2022-02-18 13:10:38.276026) 🚨 📜 ║  https://api.stream-io-api.com/api/v1.0/enrich/feed/trending/all/?api_key=**&location=**&limit=100&offset=0&with_own_reactions=true&with_reaction_counts=true&with_own_children=true&ranking=**
I/flutter (20724): (2022-02-18 13:10:38.276200) 🚨 📜 ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
I/flutter (20724): NoSuchMethodError: The getter 'length' was called on null.
I/flutter (20724): Receiver: null
I/flutter (20724): Tried calling: length #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:63:5)
I/flutter (20724): #1      _parseJson (dart:convert-patch/convert_patch.dart:39:28)
I/flutter (20724): #2      JsonDecoder.convert (dart:convert/json.dart:506:36)
I/flutter (20724): #3      JsonCodec.decode (dart:convert/json.dart:157:41)
I/flutter (20724): #4      new StreamFeedsNetworkError.fromDioError (package:stream_feed/src/core/error/stream_feeds_error.dart:45:23)
I/flutter (20724): #5      StreamHttpClient._parseError (package:stream_feed/src/core/http/stream_http_client.dart:81:39)
I/flutter (20724): #6      StreamHttpClient.get (package:stream_feed/src/core/http/stream_http_client.dart:105:13)
I/flutter (20724): <asynchronous suspension>
I/flutter (20724): #7      FlatFeed.getEnrichedActivities (package:stream_feed/src/client/flat_feed.dart:133:20)
I/flutter (20724): <asynchronous suspension>
I/flutter (20724): #8      FutureExtensions.onError.<anonymous closure> (dart:async/future.dart)
I/flutter (20724): <asynchronous suspension>
[sentry] [debug] Event 7c8bd7b4f4af45c694596abf63036512 was dropped due to sampling decision```

sharansingh00002 avatar Feb 23 '22 07:02 sharansingh00002

Hi @sharansingh00002, thanks for opening an issue. Can you try if this fix works for you?

dependencies:   
  stream_feed:
     git:
       url: https://github.com/GetStream/stream-feed-flutter.git
       ref: timeout-error
       path: ./packages/stream_feed

Also, regarding your timeout issue, you can choose a server location closer to you (for development purposes) or your users

sachaarbonel avatar Feb 23 '22 22:02 sachaarbonel