-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Always write error on first attempt OTA ESP32 S3 #12
Comments
I found out it only happens on the first update (after i upload the file to the web server). It is caused by int totalLength = http.getSize(); resulting in -1. (Maybe content-length header missing? When I use two devices, flash them with same version. Then I upload a new version to web server. The first device I want to update via OTA gives the error code 2. Reboot and update via OTA is successful. After that, I use the second device and do the OTA update, it works perfect immediately. I think it has something to do with the web server. Remember something from the past when deploying a new version of a ASP application the first request always failed. Will find out. |
My nginx webserver, with a new firmware file, does not have the content-length header response on the first request. |
Thanks for the analysis, @evanderkuy. Is there a solution to this problem that we can add to the library? Perhaps infer the content-length somehow? |
What is annoying now, is that I have to reboot the device to make the second request, or else I get error 4 messages for every try. For an end-user on a device, I can image they will try again without rebooting. Tried to http.end(); but that did not work. Haven't looked further into it. I will try a different server to host the firmware files. It is not a big problem as when I publish I can make the first request my selves. |
This is likely a Chunked HTTP response issue. You don't get a content-length with this. Refer to my latest pull request that explicitly requests the HTTP call be downgraded to HTTP 1.0. I've had all sorts of issues over the years with basic end-points on servers that do this chunking. |
Have implemented fix in my fork @ https://github.com/mrcodetastic/ESP32-OTA-Pull/tree/main |
Thank you!! |
When I try to update to a new firmware version, I always get a write error (code 2). If try it again I will receive error code 4. Than when I reboot, do an update and it will succeed. What am I missing?
Etienne
The text was updated successfully, but these errors were encountered: