time.now() error: time: now: cannot set array element for non-numeric key 'key_name'
#200
-
Hey team, we are running into a substation error when we are trying to use the time.now() transform. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@viraj-lunani Substation uses sjson for modifying JSON in-place, and that error can be traced here:
Based on that, the JSON object you're attempting to put the time into is likely an array -- the error is saying that you can't index an array with a non-numeric value (which in this case is |
Beta Was this translation helpful? Give feedback.
@viraj-lunani I was able to reproduce your issue, and I think this confirms that the events you're processing must be arrays. You can test this yourself using these files with this example app.
config.jsonnet
:data.json
:The error returned by the app is:
If the event is an object (e.g.
{"a":"b"}
) then it works as expected. We don't print m…