From aa53a85774a39b2f60a322628060bc8812b7fcde Mon Sep 17 00:00:00 2001 From: "J. Emrys Landivar" Date: Fri, 29 Apr 2022 12:22:25 -0500 Subject: [PATCH] fix(flux): inject sane defaults dependency for flux (#23309) (#23314) This is to prevent an error and also to remove the size limit for queries. / # cat broke.flux import "types" host="http://127.0.0.1:8086" token="myuser:mypass" from(bucket: "vehicle_communication/30days", host: host, token: token) |> range(start: -1h) |> filter(fn: (r) => types.isType(v: r["_value"], type: "int")) |> aggregateWindow(every: 1m, fn: mean) / # cat broke.flux | /influx -username influx_support -type flux -password {"error":"failed to initialize execute state: Provider.ReaderFor called on an error dependency"} --- flux/stdlib/influxdata/influxdb/dependencies.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/flux/stdlib/influxdata/influxdb/dependencies.go b/flux/stdlib/influxdata/influxdb/dependencies.go index f011b3e64b..fbf0ae0ace 100644 --- a/flux/stdlib/influxdata/influxdb/dependencies.go +++ b/flux/stdlib/influxdata/influxdb/dependencies.go @@ -5,6 +5,10 @@ import ( "errors" "github.com/influxdata/flux" + "github.com/influxdata/flux/dependencies" + "github.com/influxdata/flux/dependencies/http" + "github.com/influxdata/flux/dependencies/secret" + "github.com/influxdata/flux/dependencies/url" "github.com/influxdata/influxdb/coordinator" ) @@ -65,7 +69,16 @@ func NewDependencies( authEnabled bool, writer PointsWriter, ) (Dependencies, error) { - fdeps := flux.NewDefaultDependencies() + validator := &url.PassValidator{} + fdeps := dependencies.NewDefaultDependencies("") + fdeps.Deps = flux.Deps{ + Deps: flux.WrappedDeps{ + HTTPClient: http.NewDefaultClient(validator), + FilesystemService: nil, + SecretService: secret.EmptySecretService{}, + URLValidator: validator, + }, + } deps := Dependencies{FluxDeps: fdeps} deps.StorageDeps = StorageDependencies{ Reader: reader,