Wait for the IoT-Agent to be ready, and retry the device batches - #17
Merged
Merged
Conversation
waitForIoTAgent loops while the HTTP code is 000, so it stops waiting as soon as the port answers ANYTHING - including the 503 the agent serves while still initialising. link-devices then runs against an agent that is not ready. IoT-Agent, IoT-Agent-JSON and Big-Data-Spark already wait on the container health status; this brings it into line. link-devices also POSTs several ~30 KB device batches with no retry, under 'set -e'. The agent intermittently closes the connection without replying (curl exit 52, 'empty reply from server'), most often on the batch immediately following provision-devices - and one such reply kills the script silently, leaving the tutorial stopped at 'Link Devices to Animal entities' with no error shown. Verified intermittent: the identical payload against the same agent gave exit=52 then exit=0 back to back, and a single device is accepted with 201 throughout, so it is not a size limit (31 KB against a 1 MB expressLimit). With --retry on those two calls the tutorial starts cleanly.
jason-fox
approved these changes
Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This tutorial cannot currently be started: it stops at
⏳ Link Devices to Animal entitiesand never reaches its first step. Two separate causes.1.
waitForIoTAgentstops waiting too earlyIt waits only while the code is
000(nothing listening), so it stops as soon as the port answers anything — including the503the agent serves while still initialising.provision-devicesandlink-devicesthen run against an agent that isn't ready.IoT-Agent,IoT-Agent-JSONandBig-Data-Sparkalready wait on the container health status instead; this brings it into line.2.
link-deviceshas no retry, underset -eIt POSTs several ~30 KB device batches. The agent intermittently closes the connection without replying — curl exit 52, "empty reply from server" — most often on the batch immediately following
provision-devices. Because the script runs underset -e, one such reply kills it silently, with no error shown to the reader.⭐ Verified intermittent rather than assumed: the identical payload against the same agent gave exit=52 then exit=0 back to back. A single device is accepted with
201throughout, and 31 KB is nowhere near the agent's 1 MBexpressLimit, so it isn't a size limit.--retry 10 --retry-all-errors --retry-delay 10on those two calls. Tested end-to-end: with only this change the tutorial starts cleanly (servicesexits 0) and its steps run.Found while running all sixteen NGSI-LD tutorials against a different NGSI-LD broker — this was one of four that could never be started.