Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Help wanted] The request connection took longer than 0:00:20.000000. It was aborted. #31

Closed
leobuzhi opened this issue Apr 9, 2023 · 16 comments

Comments

@leobuzhi
Copy link

leobuzhi commented Apr 9, 2023

While running the example, I encountered the following error 1. If I set the proxy for HttpSetup, I encounter error 2.

Error 1:
(base) ➜ example git:(main) ✗ flutter run
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 2,703ms
Xcode build done. 7.3s
Syncing files to device iPhone 13... 123ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:65388/S7AYxR2iYWY=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:65388/S7AYxR2iYWY=/

Performing hot restart...
Restarted application in 354ms.
flutter:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception:
status code :null message :The request connection took longer than 0:00:20.000000. It was aborted.
data:null

Error 2:
void initState() {
openAI = OpenAI.instance.build(
token: token,
baseOption: HttpSetup(
proxy: "localhost:1087",
receiveTimeout: const Duration(seconds: 20),
connectTimeout: const Duration(seconds: 20)),
isLog: true);
super.initState();
}

(base) ➜ example git:(main) ✗ flutter run
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 2,496ms
Xcode build done. 8.8s
Syncing files to device iPhone 13... 108ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:49416/nGCSjrR8sk8=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:49416/nGCSjrR8sk8=/
flutter:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception:
status code :null message :null
data:null

@redevrx
Copy link
Owner

redevrx commented Apr 9, 2023 via email

@leobuzhi
Copy link
Author

Still haven't solved the problem.

(base) ➜ example git:(main) ✗ flutter run
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 6.9s
Xcode build done. 22.6s
Syncing files to device iPhone 13... 330ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:60639/d5UPNmD2irU=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:60639/d5UPNmD2irU=/
flutter:
flutter:

(base) ➜ client git:(main) ✗ ping api.openai.com
PING api.openai.com (104.18.6.192): 56 data bytes
64 bytes from 104.18.6.192: icmp_seq=0 ttl=57 time=161.608 ms
64 bytes from 104.18.6.192: icmp_seq=1 ttl=57 time=165.892 ms
64 bytes from 104.18.6.192: icmp_seq=2 ttl=57 time=161.090 ms
64 bytes from 104.18.6.192: icmp_seq=3 ttl=57 time=162.182 ms
^C
--- api.openai.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 161.090/162.693/165.892/1.887 ms

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023

your have error ?

@leobuzhi
Copy link
Author

your have error ?

(base) ➜ example git:(main) ✗ flutter run
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 7.6s
Xcode build done. 33.0s
Syncing files to device iPhone 13... 424ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

💪 Running with sound null safety 💪

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:65085/MvM7AE3FZSc=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:65085/MvM7AE3FZSc=/
flutter:
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception:
status code :null message :The request connection took longer than 0:00:50.000000. It was aborted.
data:null

#0 OpenAIClient.post (package:chat_gpt_sdk/src/client/openai_client.dart:85:7)

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023 via email

@leobuzhi
Copy link
Author

I have tried using both proxy and normal APIs, but neither of them worked.

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023 via email

@leobuzhi
Copy link
Author

Normal APIs you try new version , I upload last time and if have error you case ask me.

I pulled the latest code(commit 46a3bee), but it still gave an error. The error message is as follows.

An Observatory debugger and profiler on iPhone 13 is available at: http://127.0.0.1:54369/DmhC3aQzclM=/
The Flutter DevTools debugger and profiler on iPhone 13 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:54369/DmhC3aQzclM=/
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception:
status code :null message :null
data:null

#0 OpenAIClient.post (package:chat_gpt_sdk/src/client/openai_client.dart:132:7)

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023 via email

@leobuzhi
Copy link
Author

You can show code ?

I just run this code and replace my token in constants.dart. https://github.com/redevRx/Flutter-ChatGPT/tree/main/example/lib

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023 via email

@leobuzhi
Copy link
Author

You add permission internet in iOS or android right ?

I can visit google in my iOS simulator.

@redevrx
Copy link
Owner

redevrx commented Apr 10, 2023 via email

@leobuzhi
Copy link
Author

leobuzhi commented Apr 10, 2023

It's still not work, and my config is as follows.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSAppTransportSecurity</key>
	<dict>
   		<key>NSAllowsArbitraryLoads</key><true/>
	</dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleDisplayName</key>
	<string>Example</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>example</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>$(FLUTTER_BUILD_NAME)</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>$(FLUTTER_BUILD_NUMBER)</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>
	<key>CADisableMinimumFrameDurationOnPhone</key>
	<true/>
	<key>UIApplicationSupportsIndirectInputEvents</key>
	<true/>
</dict>
</plist>

I also found your solution on StackOverflow.

@redevrx
Copy link
Owner

redevrx commented Apr 11, 2023

you try run on android device.

@leobuzhi
Copy link
Author

you try run on android device.

I found this PR, and I try it, it's works(translate and chat).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants