Skip to content

Remove "expectedVersion" field from job update message #134

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kvp1703
Copy link
Contributor

@kvp1703 kvp1703 commented Jun 5, 2025

Fix: Remove hardcoded expectedVersion from OTA success message to prevent re-download loop

Description

This change addresses an issue where the device would continuously re-download an OTA package without success. The root cause was a hardcoded expectedVersion ("2") in the OTA success message sent to AWS IoT Jobs.

The expectedVersion field in the job status update is optional. This commit removes the expectedVersion from the success message payload by directly formatting the JSON string using snprintf instead of Jobs_UpdateMsg. This prevents the mismatch or incorrect versioning that led to the re-download loop.

This resolves issue #120.

Test Steps

  1. Set up the ESP32 device for an OTA update via MQTT as per the demo's original configuration (prior to this change).
  2. Trigger an OTA update with a new firmware version.
  3. Observe (Before Change): The device might download the firmware, apply it, but then potentially re-download the same firmware package repeatedly because the expectedVersion in the success message was hardcoded and might not match the actual next expected version from the perspective of the OTA service or job document.
  4. Apply the changes from this Pull Request to the ota_over_mqtt_demo.c file.
  5. Re-flash the device and trigger the same OTA update again.
  6. Observe (After Change): The device should download the firmware, apply it, and send a success message. It should then remain in a stable state, successfully updated, and not attempt to re-download the same package. The OTA job should be marked as "SUCCEEDED" in AWS IoT Jobs.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

issue #120.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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

Successfully merging this pull request may close these issues.

1 participant