-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger/Docs Panic: no / before catch-all in path '\/sw\*any' #132
Comments
@feidhlimx The above boot.yaml works in my Mac environment, I will find a windows machine to reproduce the problem |
@friesoft Good catch. There are some places use filepath.join() function while joining URL. Your solution looks correct. I will fix this bug ASAP |
@friesoft Please pull the latest version of rk-boot and dependencies. I think new releases will fix the problem. |
Thanks, we will be testing within the next days :) |
This problem is tested and fixed with version github.com/rookie-ninja/rk-boot/v2 v2.2.12 Thanks! |
Describe the bug
Swagger / Docs enabled in boot.yaml produces panic in rk-boot - Bootstrap
go/pkg/mod/github.com/rookie-ninja/rk-boot/v2@v2.2.11/boot.go:174
panic: no / before catch-all in path '/\sw*any'
To Reproduce
Steps to reproduce the behavior:
Desktop (please complete the following information):
func main() {
boot := rkboot.NewBoot()
...
boot.Bootstrap(context.TODO())
boot.WaitForShutdownSig(context.TODO())
}
boot,yaml includes (extract):
gin:
port: 8088
enabled: true
loggerEntry: zap-log
eventEntry: event-log
commonService:
enabled: true # health endpoints
pathPrefix: "/restricted/common"
sw:
enabled: true # Swagger UI
path: "/sw"
docs:
enabled: true # API Doc
path: "/docs"
prom:
enabled: true # Prometheus Client
path: "/public/metrics"
middleware:
logging:
enabled: true
loggerEncoding: "json"
loggerOutputPaths: ["stdout"]
eventEncoding: "json"
eventOutputPaths: ["stdout"]
prom:
enabled: true
meta:
enabled: true
trace:
enabled: true
Additional context
{"level":"ERROR","ts":"2022-11-23T09:56:32.916+0100","caller":"v2@v2.2.11/boot.go:257","msg":"Panic occured, shutting down... \ngoroutine 1 [running]:\nruntime/debug.Stack()\n\tC:/Program Files/Go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/rookie-ninja/rk-boot/v2.syncLog({0xc000620000, 0x24})\n\tC:/Users//go/pkg/mod/github.com/rookie-ninja/rk-boot/v2@v2.2.11/boot.go:249 +0x65\npanic({0x12034a0, 0xc000339280})\n\tC:/Program Files/Go/src/runtime/panic.go:838 +0x207\ngithub.com/gin-gonic/gin.(*node).insertChild(0x12e2840?, {0xc00039b532?, 0x0?}, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users/mcconig/go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/tree.go:363 +0xb2e\ngithub.com/gin-gonic/gin.(*node).addRoute(0x1374618?, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/tree.go:252 +0xa39\ngithub.com/gin-gonic/gin.(*Engine).addRoute(0xc00008cea0, {0x1374618, 0x3}, {0xc00039b530, 0x9}, {0xc00020d1d0, 0x6, 0x6})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/gin.go:331
+0x226\ngithub.com/gin-gonic/gin.(*RouterGroup).handle(0xc00008cea0, {0x1374618, 0x3}, {0xc00039b4f0?, 0xc00020cb10?}, {0xc0000068f0, 0x1, 0x68?})\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/routergroup.go:88 +0x145\ngithub.com/gin-gonic/gin.(*RouterGroup).GET(...)\n\tC:/Users//go/pkg/mod/github.com/gin-gonic/gin@v1.8.1/routergroup.go:116\ngithub.com/rookie-ninja/rk-gin/v2/boot.(*GinEntry).Bootstrap(0xc00062adc0, {0x1685d40, 0xc00020cb10})\n\tC:/Users/mcconig/go/pkg/mod/github.com/rookie-ninja/rk-gin/v2@v2.2.14/boot/gin_entry.go:387 +0x53f\ngithub.com/rookie-ninja/rk-boot/v2.(*Boot).Bootstrap(0xc0001aed20, {0x1685cd0, 0xc000036068})\n\tC:/Users/mcconig/go/pkg/mod/github.com/rookie-ninja/rk-boot/v2@v2.2.11/boot.go:174 +0x46e\nmain.main()\n\tC:/Users//repos/configcontrol-api-ssh/api/main.go:28 +0x575\n","eventId":"d1e0a1e6-3095-408a-9e1c-a19a2edfdb3c","RootCause":"no / before catch-all in path '/\sw\*any'"}
panic: no / before catch-all in path '/\sw*any' [recovered]
panic: no / before catch-all in path '/\sw*any'
go.mod:
go 1.18
require (
github.com/gin-gonic/gin v1.8.1
github.com/rookie-ninja/rk-boot/v2 v2.2.11
github.com/rookie-ninja/rk-db/mysql v1.2.12
github.com/rookie-ninja/rk-entry/v2 v2.2.11
github.com/rookie-ninja/rk-gin/v2 v2.2.14
github.com/swaggo/swag v1.8.7
gorm.io/gorm v1.24.1
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gin-contrib/pprof v1.3.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/rookie-ninja/rk-logger v1.2.12 // indirect
github.com/rookie-ninja/rk-query v1.2.14 // indirect
github.com/rs/xid v1.3.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
go.opentelemetry.io/contrib v1.8.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.10.0 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
The text was updated successfully, but these errors were encountered: