influxdata / influxdata/influxdb
Flux "undefined identifier" referencing import within functions using influxdb 1.8.1
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.
1. enter the following query in influx cli..
```
import "date"
ds = from(bucket:"idping")
|> range(start: -1h)
|> map(fn: (r) => ({
dow: date.weekDay(t: time(v: r._time)),
}))
|> yield()
```
2. observe response: `Error: unknown server error: 500 Internal Server Error` and `undefined identifier` error in logs
__Expected behavior:__
Import should be referenced such that I can run the relevant function
__Actual behavior:__
Flux couldn't find the identifier for the import. The same is true using filter() and map() so I suspect its true for all functions.
__Environment info:__
* System info: Linux 3.16.0-4-amd64 x86_64
* InfluxDB version: InfluxDB v1.8.1 (git: 1.8 af0237819ab9c5997c1c0144862dc762b9d8fc25)
__Config:__
```
logging-enabled = true
write-tracing = true
trace-logging-enabled = true
flux-enabled = true
flux-log-enabled = true
auth-enabled = false
```
__Logs:__
```
Jul 22 10:46:05 logstats-601 influxd[10389]: ts=2020-07-22T08:46:05.339313Z lvl=info msg="Executed Flux query" log_id=0O0RkrPW000 service=httpd compiler_type=REPL response_size=0 query= error="compile function @ 0:0-0:0: type error 0:0-0:0: undefined identifier \"date\"" stat_total_duration=0.000ms stat_compile_duration=0.000ms stat_queue_duration=0.000ms stat_plan_duration=0.000ms stat_requeue_duration=0.000ms stat_execute_duration=0.000ms stat_max_allocated=960 stat_concurrency=0
Jul 22 10:46:05 logstats-601 influxd[10389]: [httpd] ::1 - - [22/Jul/2020:10:46:05 +0200] "POST /api/v2/query HTTP/1.1" 500 86 "-" "Go-http-client/1.1" c78af0b7-cbf7-11ea-a540-027f27d58381 3991
Jul 22 10:46:05 logstats-601 influxd[10389]: ts=2020-07-22T08:46:05.339368Z lvl=error msg="[500] - \"compile function @ 0:0-0:0: type error 0:0-0:0: undefined identifier \\\"date\\\"\"" log_id=0O0RkrPW000 service=httpd
```
Contributor guide
Assessment
This issue has not been assessed yet.