-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
Describe the bug
tedge-flows service detects the file changes automatically and reloads the scripts.
However, I found a corner case, where tedge-flows still uses an old script path instead of the new one after specific steps.
To Reproduce
Preparation:
a flow test.toml
input.mqtt.topics = ["test/in"]
steps = [
{ script = "test-old.js" },
]and test-old.js
export function onMessage(message, context) {
return [{
topic: "test/out",
payload: `{"old":"I am from test-old.js"}`
}]
}Step to reproduce
- Change the script path to
test-new.js, which doesn't exist yet.
steps = [
{ script = "test-new.js" },
]
- You can confirm the script doesn't exist by
tedge flow test test/in ''
$ tedge flows test test/in ''
2026-02-11T13:05:43.574928405Z ERROR flows: Failed to compile flow /etc/tedge/mappers/flows/flows/test.toml: Cannot read file /etc/tedge/mappers/flows/flows/test-new.js: No such file or directory (os error 2)tedge-flowsservice still converts the message based on the oldtest-old.jsdefinition.
[test/in]
[test/out] {"old":"I am from test-old.js"}- Create
test-new.jswith this contents.
export function onMessage(message, context) {
return [{
topic: "test/out",
payload: `{"new":"I am from test-new.js"}`
}]
}tedge flows testcommand uses the new script.
$ tedge flows test test/in ''
[test/out] {"new":"I am from test-new.js"}- However,
tedge-flowsservice still uses the old definition.
[test/in]
[test/out] {"old":"I am from test-old.js"}- To recover this, restart the
tedge-flowsservice. After restart,
[test/in]
[test/out] {"new":"I am from test-new.js"}Expected behavior
tedge-flows service uses the new script contents without restarting it.
Screenshots
Environment (please complete the following information):
- OS [incl. version]
- Hardware [incl. revision]
- System-Architecture
Linux 2c8819180ed5 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 22:03:50 UTC 2024 aarch64 GNU/Linux - thin-edge.io version:
tedge 1.7.2~143+g747f913
Additional context
Restarting tedge-flows service resolves the issue.
Reactions are currently unavailable