Skip to content

time.now() error: time: now: cannot set array element for non-numeric key 'key_name' #200

Answered by jshlbrd
viraj-lunani asked this question in Q&A
Discussion options

You must be logged in to vote

@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:

local sub = import '../../../../../build/config/substation.libsonnet';

{
  transforms: [
    sub.tf.time.now({obj: {trg: 'key_name.model.event.ingested'}}),
    sub.tf.send.stdout(),
  ]
}

data.json:

["a", "b", "c"]

The error returned by the app is:

% ./substation -config config.json -file data.json
panic: main: transform d2bf04d0-ad0d7ee5: cannot set array element for non-numeric key 'key_name'

If the event is an object (e.g. {"a":"b"}) then it works as expected. We don't print m…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jshlbrd
Comment options

Answer selected by viraj-lunani
@viraj-lunani
Comment options

@shellcromancer
Comment options

@viraj-lunani
Comment options

@jshlbrd
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants