Hello,
I am trying to create a simple task that will report some measurements back to my custom endpoint but getting error while trying to submit the task to my influxdb OSS 2.0. I have tested my flux code into “data explorer” and works fine but not when i am trying to submit it as a task. My code:
import “json”
import “http”
data = from(bucket: “metrics”)
|>range(start: -30d)
|>filter(fn: (r) => r._measurement == “temperature”)
|>last()|>yield()
lastReported = data
|>tableFind(fn: (key) => key._measurement == “temperature”)
|>getRecord(idx: 0)
j = json.encode(v: lastReported)
http.post(url: “https://myurl…”,
headers: {“Content-type”: “application/x-www-form-urlencoded”},
data: j)
Error Message:
Failed to update task: failed to update task: invalid options: error calling function “tableFind” @13:5-14:39: no execution context for tableFind to use
I have searched for the issue but it seems that there is nothing relative of it.
Thanks in advance!