Thank you so much for the quick response! It solved my problem! And sorry for the late answer.
Unfortunately I am facing a new issue when creating a notification rule.
This is my request body:
{
"endpointID": "<endpointID>",
"name": "<name>",
"orgID": "<orgID>",
"status": "active",
"type": "http",
"statusRules": [
{
"currentLevel": "CRIT"
}
]
}
And the response is an internal error:
{
"code": "internal error",
"message": "a panic has occurred: /api/v2/notificationRules: runtime error: invalid memory address or nil pointer dereference"
}
The output from the database is the following.
2021-09-20T13:53:47.625052Z error a panic has occurred {"log_id": "0WhsaOQG000", "handler": "panic", "error": "/api/v2/notificationRules: runtime error: invalid memory address or nil pointer dereference"}
goroutine 2932 [running]:
runtime/debug.Stack(0xc0029f0ea0, 0xc001c34802, 0x56223a7a9387)
runtime/debug/stack.go:24 +0x9f
github.com/influxdata/influxdb/v2/http.baseHandler.panic(0x56223c348f58, 0x56223ba80990, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00, 0x56223bf67580, 0x56223d2723d0)
github.com/influxdata/influxdb/v2/http/router.go:96 +0x21d
github.com/influxdata/httprouter.(*Router).recv(0xc002dbbdd0, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/influxdata/httprouter@v1.3.1-0.20191122104820-ee83e2772f69/router.go:361 +0x7e
panic(0x56223bf67580, 0x56223d2723d0)
runtime/panic.go:965 +0x1b9
github.com/influxdata/influxdb/v2/notification/rule.increaseDur(0x0, 0x10)
github.com/influxdata/influxdb/v2/notification/rule/rule.go:256 +0x40
github.com/influxdata/influxdb/v2/notification/rule.(*Base).generateFluxASTStatuses(0xc0023977a0, 0x56223c3b0808, 0xc00250b000)
github.com/influxdata/influxdb/v2/notification/rule/rule.go:294 +0x49
github.com/influxdata/influxdb/v2/notification/rule.(*HTTP).generateFluxASTBody(0xc0023977a0, 0xc00250b000, 0xc0023bf740, 0x4, 0x4)
github.com/influxdata/influxdb/v2/notification/rule/http.go:62 +0x251
github.com/influxdata/influxdb/v2/notification/rule.(*HTTP).GenerateFluxAST(0xc0023977a0, 0xc00250b000, 0x56223c388ce0, 0xc002cec570, 0x82cdc785abb1000)
github.com/influxdata/influxdb/v2/notification/rule/http.go:36 +0x85
github.com/influxdata/influxdb/v2/notification/rule.(*HTTP).GenerateFlux(0xc0023977a0, 0x56223c3b0808, 0xc00250b000, 0x82cdc785abb1000, 0x56223c3b0808, 0xc00250b000, 0x0)
github.com/influxdata/influxdb/v2/notification/rule/http.go:24 +0x59
github.com/influxdata/influxdb/v2/notification/rule/service.(*RuleService).createNotificationTask(0xc000bdd960, 0x56223c388ce0, 0xc002cec570, 0x56223c3b34f8, 0xc0023977a0, 0xc002ce4e18, 0x6, 0x2a, 0x56223bfedc01, 0x24)
github.com/influxdata/influxdb/v2/notification/rule/service/service.go:160 +0xd0
github.com/influxdata/influxdb/v2/notification/rule/service.(*RuleService).CreateNotificationRule(0xc000bdd960, 0x56223c388ce0, 0xc002cec570, 0x56223c3b34f8, 0xc0023977a0, 0xc002ce4e18, 0x6, 0x82bd4a44b1b1000, 0x11, 0x0)
github.com/influxdata/influxdb/v2/notification/rule/service/service.go:119 +0x1bd
github.com/influxdata/influxdb/v2/task/backend/middleware.(*CoordinatingNotificationRuleStore).CreateNotificationRule(0xc0007d6840, 0x56223c388ce0, 0xc002cec570, 0x56223c3b34f8, 0xc0023977a0, 0xc002ce4e18, 0x6, 0x82bd4a44b1b1000, 0x5, 0x56223a79f33c)
github.com/influxdata/influxdb/v2/task/backend/middleware/notification_middleware.go:37 +0xa5
github.com/influxdata/influxdb/v2/authorizer.(*NotificationRuleStore).CreateNotificationRule(0xc000637410, 0x56223c388ce0, 0xc002cec570, 0x56223c3b34f8, 0xc0023977a0, 0xc002ce4e18, 0x6, 0x82bd4a44b1b1000, 0x0, 0x0)
github.com/influxdata/influxdb/v2/authorizer/notification_rule.go:56 +0x11a
github.com/influxdata/influxdb/v2/http.(*NotificationRuleHandler).handlePostNotificationRule(0xc002dbbe60, 0x56223c3766e8, 0xc0023bf340, 0xc00250af00)
github.com/influxdata/influxdb/v2/http/notification_rule.go:588 +0x42a
net/http.HandlerFunc.ServeHTTP(0xc002dce040, 0x56223c3766e8, 0xc0023bf340, 0xc00250af00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/http.(*proxyHandler).ServeHTTP(0xc000dc1960, 0x56223c3766e8, 0xc0023bf340, 0xc00250af00)
github.com/influxdata/influxdb/v2/http/proxy_handler.go:33 +0x9d
github.com/influxdata/httprouter.(*Router).Handler.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250af00, 0x0, 0x0, 0x0)
github.com/influxdata/httprouter@v1.3.1-0.20191122104820-ee83e2772f69/router.go:325 +0x1e7
github.com/influxdata/httprouter.(*Router).ServeHTTP(0xc002dbbdd0, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/influxdata/httprouter@v1.3.1-0.20191122104820-ee83e2772f69/router.go:453 +0xa9b
github.com/go-chi/chi.(*Mux).Mount.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:298 +0x122
net/http.HandlerFunc.ServeHTTP(0xc000dc1ae0, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/go-chi/chi.(*Mux).routeHTTP(0xc002dabe00, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:431 +0x28b
net/http.HandlerFunc.ServeHTTP(0xc002da1980, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/kit/transport/http.SetCORS.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:35 +0xcd
net/http.HandlerFunc.ServeHTTP(0xc0009fc840, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/go-chi/chi/middleware.StripSlashes.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/go-chi/chi@v4.1.0+incompatible/middleware/strip.go:25 +0xee
net/http.HandlerFunc.ServeHTTP(0xc0009fc858, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/kit/transport/http.SkipOptions.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:73 +0xba
net/http.HandlerFunc.ServeHTTP(0xc0009fc900, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/http.panicMW.func1.1(0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/influxdata/influxdb/v2/http/router.go:126 +0x93
net/http.HandlerFunc.ServeHTTP(0xc000dc13c0, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
net/http/server.go:2069 +0x46
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc002dabe00, 0x56223c3766e8, 0xc0023bf340, 0xc00250ae00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:70 +0x50c
github.com/influxdata/influxdb/v2/kit/feature.(*Handler).ServeHTTP(0xc002df5f80, 0x56223c3766e8, 0xc0023bf340, 0xc00250ad00)
github.com/influxdata/influxdb/v2/kit/feature/middleware.go:43 +0x2a2
github.com/influxdata/influxdb/v2/http.(*AuthenticationHandler).ServeHTTP(0xc0005e0380, 0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
github.com/influxdata/influxdb/v2/http/authentication_middleware.go:125 +0x2d2
github.com/influxdata/influxdb/v2/kit/transport/http.SetCORS.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:35 +0xcd
net/http.HandlerFunc.ServeHTTP(0xc000e0cd38, 0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/kit/transport/http.SkipOptions.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:73 +0xba
net/http.HandlerFunc.ServeHTTP(0xc000e0cd50, 0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/http.(*PlatformHandler).ServeHTTP(0xc000959d10, 0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
github.com/influxdata/influxdb/v2/http/platform_handler.go:78 +0x154
github.com/go-chi/chi.(*Mux).Mount.func1(0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:298 +0x122
net/http.HandlerFunc.ServeHTTP(0xc00061ec00, 0x56223c3766e8, 0xc0023bf340, 0xc00250ac00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/kit/transport/http.Metrics.func1.1(0x56223c37cad8, 0xc002397500, 0xc00250ac00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:58 +0x191
net/http.HandlerFunc.ServeHTTP(0xc002dff380, 0x56223c37cad8, 0xc002397500, 0xc00250ac00)
net/http/server.go:2069 +0x46
github.com/influxdata/influxdb/v2/kit/transport/http.Trace.func1.1(0x56223c37cad8, 0xc002397500, 0xc00250ac00)
github.com/influxdata/influxdb/v2/kit/transport/http/middleware.go:98 +0x38f
net/http.HandlerFunc.ServeHTTP(0xc000ed79b0, 0x56223c37cad8, 0xc002397500, 0xc00250ab00)
net/http/server.go:2069 +0x46
github.com/go-chi/chi.(*ChainHandler).ServeHTTP(0xc002dff3c0, 0x56223c37cad8, 0xc002397500, 0xc00250ab00)
github.com/go-chi/chi@v4.1.0+incompatible/chain.go:31 +0x54
github.com/go-chi/chi.(*Mux).routeHTTP(0xc002dfa420, 0x56223c37cad8, 0xc002397500, 0xc00250ab00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:431 +0x28b
net/http.HandlerFunc.ServeHTTP(0xc002dcebd0, 0x56223c37cad8, 0xc002397500, 0xc00250ab00)
net/http/server.go:2069 +0x46
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc002dfa420, 0x56223c37cad8, 0xc002397500, 0xc0026f1e00)
github.com/go-chi/chi@v4.1.0+incompatible/mux.go:86 +0x2d1
github.com/influxdata/influxdb/v2/http.(*Handler).ServeHTTP(0xc002df80c0, 0x56223c37cad8, 0xc002397500, 0xc0026f1e00)
github.com/influxdata/influxdb/v2/http/handler.go:145 +0x57
net/http.serverHandler.ServeHTTP(0xc0009aa620, 0x56223c37cad8, 0xc002397500, 0xc0026f1e00)
net/http/server.go:2887 +0xa5
net/http.(*conn).serve(0xc0028f4500, 0x56223c388ce0, 0xc002d200c0)
net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
net/http/server.go:3013 +0x3ad
I am using version 2.0.7
Do you have any idea what I am doing wrong or is a known issue because I found this type of error also in other relations but non of the provided solution helped my out…
Best,
Vinzenz