GetStream / stream-chat-flutter

Flutter Chat SDK - Build your own chat app experience using Dart, Flutter and the Stream Chat Messaging API.
https://getstream.io/chat/sdk/flutter/
Other
880 stars 313 forks source link

Getting issue on iOS app in host lookup #1937

Closed luvishq closed 1 week ago

luvishq commented 2 weeks ago

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

iOS

What version are you using?

7.2.1

What happened?

It's giving an issue while connecting to the stream_chat client , here's the crash I am seeing in logs:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Failed host lookup: 'chat.stream-io-api.com' (OS Error: nodename nor servname provided, or not known, errno = 8)

0 _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721:35)

1 _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1914:26)

2 RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)

3 RawSecureSocket.startConnect (dart:io/secure_socket.dart:299:22)

4 SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)

5 _ConnectionTarget.connect (dart:_http/http_impl.dart:2480:26)

6 _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2923:12)

7 _HttpClient._getConnection (dart:_http/http_impl.dart:2928:12)

8 _HttpClient._openUrl (dart:_http/http_impl.dart:2783:12)

9 _HttpClient.openUrl (dart:_http/http_impl.dart:2620:7)

Steps to reproduce

1. Integrate the SDK in flutter
2. Launch the app on iOS, it works on Android and Web though

Supporting info to reproduce

No response

Relevant log output

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SocketException: Failed host lookup: 'chat.stream-io-api.com' (OS Error: nodename nor servname provided, or not known, errno = 8)
#0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:721:35)
#1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1914:26)
#2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
#3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:299:22)
#4      SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)
#5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2480:26)
#6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2923:12)
#7      _HttpClient._getConnection (dart:_http/http_impl.dart:2928:12)
#8      _HttpClient._openUrl (dart:_http/http_impl.dart:2783:12)
#9      _HttpClient.openUrl (dart:_http/http_impl.dart:2620:7)

Flutter analyze output

laavaans@Laavaans-MacBook-Pro laavaaninc % flutter analyze
Analyzing laavaaninc...                                                 

warning • Unused import: 'package:laavaan/feature_modules/_global_features/analytics/analytics.dart' • lib/core/utils/routes.dart:4:8 • unused_import
warning • Unused import: 'package:laavaan_support/laavaan_support.dart' • lib/core/utils/routes.dart:52:8 • unused_import
warning • The value of the local variable 'callbackUri' isn't used • lib/feature_modules/_global_features/deeplink_handler/deeplink_handler.dart:37:9 • unused_local_variable

3 issues found. (ran in 10.9s)

Flutter doctor output

laavaans@Laavaans-MacBook-Pro laavaaninc % flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-x64, locale en-US)
    • Flutter version 3.22.1 on channel stable at /Users/laavaans/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (3 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/laavaans/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.74.1)
    • VS Code at /Users/laavaans/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (5 available)
    • Pixel 7a (mobile)              • 39161JEHN03918                       • android-arm64  • Android 14 (API 34)
    • Sab13 A’s iPhone (mobile)      • 00008101-000D58581E82001E            • ios            • iOS 17.5.1 21F90
    • iPad Air 11-inch (M2) (mobile) • E82F4EFD-1F7F-4708-98A3-CEA127E67327 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                • macos                                • darwin-x64     • macOS 14.5 23F79 darwin-x64
    • Chrome (web)                   • chrome                               • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Code of Conduct

deven98 commented 2 weeks ago

Hey @luvishq 👋 ,

It's interesting that the SDK connects on Android and not iOS, I don't think we have any specific logic that might affect this. This kind of error usually appears when the iOS app can't connect to the internet - maybe a permission or simulator issue?

Can you run some kind of internet ping from the same app using the http client and let me know if that works as well? If it runs, I will try some things on my end but this is difficult to reproduce IMO.

Thanks.

deven98 commented 1 week ago

Hey @luvishq I'm closing this issue for now but feel free to reopen this if this reoccurs and you have additional info that would help us replicate the issue. Thanks!