flux icon indicating copy to clipboard operation
flux copied to clipboard

type error 0:0-0:0: missing object properties

Open russorat opened this issue 6 years ago • 3 comments

the following query gives the error: cannot add type constraint @ 5:15-11:6: type error 0:0-0:0: missing object properties (_check_id, _check_name)

but i feel like it should work. I think it has something to do with the exists function. this is in cloud2

from(bucket: "_monitoring")
  |> range(start: -60d)
  |> filter(fn: (r) => r._measurement == "statuses" and r._field == "_message")
  |> map(fn: (r) => ({ 
    _time: r._time,
    _value: r._value,
    _check_id: if exists r._check_id then r._check_id else "Unknown",
    _check_name: if exists r._check_name then r._check_name else "Unknown",
    _level: if exists r._level then r._level else "Unknown"
  }))

russorat avatar Oct 11 '19 17:10 russorat

Any solution ? getting the same error 500 Internal Server Error: {"error":"cannot add type constraint @ 15:10-23:7: type error 0:0-0:0: missing object properties (review_id)"}

sathishsms avatar Nov 04 '22 06:11 sathishsms

@sathishsms Are you seeing this in cloud also? The original report is years old, making this extra curious.

I did a quick sanity check, running the map in the OP against some sample data:

import "sampledata"

sampledata.int() |> map(fn: (r) => ({ 
    _time: r._time,
    _value: r._value,
    _check_id: if exists r._check_id then r._check_id else "Unknown",
    _check_name: if exists r._check_name then r._check_name else "Unknown",
    _level: if exists r._level then r._level else "Unknown"
  }))

This ran without error for me in cloud. The error sounds like it comes from static analysis so I'd expect it to error consistently regardless of the data sent through the map call.

onelson avatar Nov 04 '22 06:11 onelson

This issue has had no recent activity and will be closed soon.

github-actions[bot] avatar May 04 '24 01:05 github-actions[bot]