Closed abinmittu closed 5 years ago
Looks similar to #13747
I get this error very very intermittently on my environment.
I have wifi Windows 10 PC running GraphQL NodeJS Express server on 192.168.1.5, trying to do http (not https) requests on http://192.168.1.5. I have a Genymotion Android phone running.
This error occurred repeatedly for one particular query type. But I somehow fixed it by changing the code to wait for response or something like that.
Do you have wireless debugging enabled?
I remember the issue occured on Genymotion (android emulator) on the same computer I was using intellij.
I ran flutter in debug mode via intellij and that's where I saw the error.
I think I fixed it by doing an await on the Future function which did the call.
If you are making connection requests inside a future which you should, make sure its an asynchronous task with await properly used. Also as a side note for images, use a placeholder just in case your app misses to fetch from network
I'm getting this error frequently as well.
I/flutter (15859): Another exception was thrown: HttpException: Connection closed before full header was received, uri = https://static.checkiday.com/img/600/doctor-563428.jpg
Could this be related to this known bug? https://github.com/dart-lang/sdk/issues/21798
Some context to my use case:
I am going to display multiple images in a list, so I precache them:
for (Event event in _events) {
precacheImage(NetworkImage(event.image), context);
}
Then I use the image that was preloaded:
FadeInImage(
placeholder: const AssetImage('assets/placeholder.jpg'),
image: NetworkImage(event.image),
fit: BoxFit.cover,
width: double.infinity,
height: 256,
),
@westy92 you probably need to do same rate limit to avoid too many concurrent requests.
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.
@westy92
I recently changed some code to wrap my image with a DecorationImage, I wonder if this might fix your problem?
I switched from using precacheImage()
to using cacheExtent
and am seeing the error less, which makes me think it is indeed due to too many concurrent connections.
I'd like to rate-limit NetworkImage
, but can't find a way to do so.
If I had access to the underlying HttpClient
, I'm guessing I could set maxConnectionsPerHost
.
I figured out how to limit the connections on the underlying HttpClient
of NetworkImage
!
I globally overrode the HttpClient
: (ref: https://github.com/flutter/flutter/issues/19588)
class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext context) {
return super.createHttpClient(context)
..maxConnectionsPerHost = 5;
}
}
void main() {
HttpOverrides.global = MyHttpOverrides();
runApp(MyApp());
}
Hopefully this fixes my issue. Thanks for the connections tip!
Hi,
I need to display a list of products and each product has an image and some details. I'm using silverlist for this purpose. I'm frequently getting " Another exception was thrown: HttpException: Connection closed before full header was received, uri = https://zoomtail-processed-images.s3.ap-south-1.amazonaws.com/raw-images/raw-W0104-005493_1.webp" this error and the above solution of overriding the global httpclient doesn't help for me.
I've tried to pre cache the network image and also tried using cacheextent, but to no avail. Could you help me with this?
Thanks.
If anyone figures out a solution, will you please, post it.
(repost from #21798)
We are building a companion application to our web-based CRM. One of the features is sms/mms. Because the information might be private, we are serving the images behind an authenticated API that redirects (302) to an S3 short term URL (5 minutes).
Anecdotally, I can say NetworkImage seems fine on conversations that only have a few images (like 2 or 3). On a conversation thread that I am using that has 9 images, frequently one or two of them will have this issue immediately. (I will get the error Connection closed before full header was received, uri = ...
in the "debug console" and those images will not load.
(A coworker pointed out that if you copy the address from the error in the debug console and paste it in a browser, it loads and is valid.)
It's going to be very embarassing if randomly, sometimes, some of the images won't show up. :-(
I finally stumbled on a StackOverflow that mentioned fixing this with cached_network_image package. I tried it out and it did fix the issue. It also had the added benefit of making the screens faster on subsequent views (because images are cached locally now).
So, although the issue still remains for others, I'm happy that I was forced to find CachedNetworkImage().
It was a very easy drop-in replacement for NetworkImage, here are the two places I had to change (the second being only a tiny bit more complex).
// BEFORE:
child: ClipRRect(
borderRadius: borderRadius,
child: Image.network(imageUrl),
),
// AFTER:
child: ClipRRect(
borderRadius: borderRadius,
child: CachedNetworkImage(
imageUrl: imageUrl,
errorWidget: (context, url, error) => Icon(Icons.error),
),
// BEFORE:
Expanded(
child: PhotoView(
imageProvider: NetworkImage(images[currentIndex].imageUrl),
),
),
// AFTER
Expanded(
child: CachedNetworkImage(
imageUrl: images[currentIndex].imageUrl,
imageBuilder: (context, imageProvider) =>
PhotoView(imageProvider: imageProvider),
),
),
@cfchris CachedNetworkImage was good to know but unfortunately, that doesn't solve the original issue here. I have same use case as yours and CachedNetworkImage just reduces the frequency but does not resolve completely. Did you experience the issue again?
@zoechi Maybe this issue needs to be reopened as the issue still persists. I am downloading image from a s3 bucket with pre signed url and it randomly fails.
Issue is still persist. Please look into it. it randomly fails, specially when we swipe through pages and there are multiple network request.
@uc-dve I fixed it using this https://pub.dev/packages/dynamic_url_image_cache
Same for me, testing flutter_map sample app:
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
Nice hack 👍
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
I don't know how this worked, or why this worked, but it was the only thing that worked
any solutions for this issue , please ???
any solutions for this issue , please ???
On my side converting urls on AWS to http didn't do the trick, I had to use that lib instead "optimized_cached_image" and it works as expected
I have the same issue. Random image occasionally failed with this error: Connection closed before full header was received . Changing url from https to http doesnt help.
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
Thank you for the fix! However, It is really sad that I cannot use an HTTPS connection for images in Flutter. I hope this gets fixed soon.
FYI I am using S3 bucket images and 5 out of 50 are failing with Connection closed before full header was received.
I am also using cached_network_image to render the images.
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
I don't know how this worked, or why this worked, but it was the only thing that worked
How do you change the request from HTTPS to HTTP 🤔? I'm having the same problem with NetworkImage
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
I don't know how this worked, or why this worked, but it was the only thing that worked
How do you change the request from HTTPS to HTTP ? I'm having the same problem with NetworkImage
What i meant by that is literally changing the request from https://mys3bucket.amazonaws.com to http://mys3bucket.amazonaws.com. I could only do that becouse the s3 bucket i am using allows me to work with http or https requests.
For those using the package cached_network_image, i made a gist with my solution https://gist.github.com/gabcarneiro/02580611279c85179db015ad2c7ed936
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
I don't know how this worked, or why this worked, but it was the only thing that worked
How do you change the request from HTTPS to HTTP ? I'm having the same problem with NetworkImage
What i meant by that is literally changing the request from https://mys3bucket.amazonaws.com to http://mys3bucket.amazonaws.com. I could only do that becouse the s3 bucket i am using allows me to work with http or https requests.
For those using the package cached_network_image, i made a gist with my solution https://gist.github.com/gabcarneiro/02580611279c85179db015ad2c7ed936
Great thanks. I just applied this to all my links
.replaceAll('https', 'http')
I'm getting the same issue here. Should really fix this.
I was having the problem while consuming images from a s3 bucket. In my case changing the request from HTTPS to HTTP worked.
Could be a workaround but far from ideal. HTTPS request is such a basic feature of any platform yet the flutter one is so buggy.
Is this issue fixed? I still face this Issue while fetching from S3 Bucket..Anyone who have Fix please Share Changing HTTPS to HTTP is not good in security Perpective..Any Thoughts and Fixes?
I am also facing this issue that fetching image from s3 randomly fails. Please fix this.
I have the same issue
does anyone look into this problem?
In my case (error "HttpException: Connection closed before full header was received") the call was to an https address using Microsoft Internet Information Services as backend, in the SSL settings of the website in IIS i had mistakenly set "Client certificates: Accept" instead of "Client certificates: Ignore", setting "Ignore" solved the problem.
Same issue! changing https to http works, but it's not a good solution if you consider security! cached_network_image package works almost every time! It sucks that this issue is still not fixed after so many months!
Any clues for a proper solution for this issue? It seems to be important and changing to http is not ideal...
i found a solution
On Mon, 14 Jun 2021 at 02:37, Juan D. Diaz @.***> wrote:
Any clues on a proper solution for this issue? It seems to be important.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/25107#issuecomment-860270174, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALD6AJWRAEFZAM73FFZRNPDTSUMX3ANCNFSM4GJFKFXQ .
i found a solution
Please share!
If is to change https to http, is not working all the time
not that i created a different cachedimage viewer widget
On Mon, 14 Jun 2021 at 14:06, Galeen @.***> wrote:
i found a solution
Please share!
If is to change https to http, is not working all the time
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/flutter/flutter/issues/25107#issuecomment-860501383, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALD6AJULRP7MPGQRKHZJKO3TSW5P3ANCNFSM4GJFKFXQ .
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Network image throwing this exception on a random image. I have a list of image thumbnails, when clicked on any, the full size image is fetched using Image.network. Suppose i have 10 images and the exception was caught on clicking the 5th image. On running the app again the exception will be on a different image say 8th one.