Comments (6)
ok, we will consider it for v3
and handle it better
from fiber.
simliar to our check
Lines 1094 to 1095 in 9b0a99b
One thing that i noticed is that Params from ctx.Route().Params return an empty slice when this case happens, so to solve this internally before a possible update from fiber is to create a helper function, something like this:
func AllParams(c *fiber.Ctx) map[string]string {
route := c.Route()
if len(route.Params) == 0 {
return nil
}
return c.AllParams()
}
Maybe help someone with the same problem.
from fiber.
Thanks for opening your first issue here! ๐ Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
from fiber.
interesting
i guess because body limit is an error which is handled on the fasthttp level and the parameters and routing comes after that
can you share the panic error
in this case, you probably have to check your own error handler for this error first and handle it without any further information
from fiber.
simliar to our check
Lines 1094 to 1095 in 9b0a99b
from fiber.
interesting i guess because body limit is an error which is handled on the fasthttp level and the parameters and routing comes after that
can you share the panic error
in this case, you probably have to check your own error handler for this error first and handle it without any further information
If the allParams expect always have a value in route property instead of a nil value, this doesn't mean that the function maybe need a change to check if the route is nil or not? maybe in a v3 of fiber?
The panic:
"runtime error: invalid memory address or nil pointer dereference"
Stack:
4 0x0000000000af3319 in github.com/gofiber/fiber/v2.(*Ctx).AllParams
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:1017
5 0x0000000001426625 in api.example/pkg/app.customErrorHandler
at /home/gabrielclaudinomarinho/projects/api.example/pkg/app/app.go:89
6 0x0000000000aea62d in github.com/gofiber/fiber/v2.(*App).ErrorHandler
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/gofiber/fiber/[email protected]/app.go:1061
7 0x0000000000aeab71 in github.com/gofiber/fiber/v2.(*App).serverErrorHandler
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/gofiber/fiber/[email protected]/app.go:1093
8 0x0000000000b1b7a5 in github.com/gofiber/fiber/v2.(*App).serverErrorHandler-fm
at <autogenerated>:1
9 0x0000000000a50f87 in github.com/valyala/fasthttp.(*Server).writeErrorResponse
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/valyala/[email protected]/server.go:2850
10 0x0000000000a4d5c5 in github.com/valyala/fasthttp.(*Server).serveConn
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/valyala/[email protected]/server.go:2287
11 0x0000000000a63c05 in github.com/valyala/fasthttp.(*Server).serveConn-fm
at <autogenerated>:1
12 0x0000000000a5f077 in github.com/valyala/fasthttp.(*workerPool).workerFunc
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:224
13 0x0000000000a5eda5 in github.com/valyala/fasthttp.(*workerPool).getCh.func1
at /home/gabrielclaudinomarinho/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196
from fiber.
Related Issues (20)
- ๐ [v3 Proposal]: Koa Style `ctx.Request` and `ctx.Response` Objects HOT 12
- ๐ [Proposal]: Add options for active DisallowUnknownFields in the function BodyParser HOT 2
- ๐ [Bug]: Incorrect Parsing of Slice by `QueryParser()` with Embedded Structs HOT 2
- ๐ [Bug]: Healthcheck middleware doesn't work with group HOT 17
- ๐ Doc: Fix code snippet indentation in /docs/api/middleware/keyauth.md HOT 4
- ๐ [Bug]: Isolation Issue with Parallel Subtests HOT 14
- ๐[Bug]: internal/storage/memory/memory_test HOT 1
- ๐ค [Question]: Validate request params HOT 5
- ๐ [v3 Proposal]: Refresh README.md HOT 2
- ๐ [v3 Proposal]: Improve more new features HOT 4
- ๐ [Bug]: (c *fiber.Ctx).ClearCookie() does absolutely nothing HOT 4
- ๐งน [v3 Maintenance]: Update docs to reflect fiber.Ctx struct to interface change HOT 1
- :bug: [BUG]: CORS panic with AcceptOrigins with whitespace HOT 1
- ๐งน [Maintenance]: Use Gotestsum for Test Workflow HOT 1
- ๐ค [Question]: Connect promhttp.Handler() to fiber app HOT 3
- ๐ [Bug]: Proxy middleware and Vite dev server on localhost, tcp4 127.0.0.1:5173: connect: connection refused HOT 6
- ๐ [Bug]: Enable go-require for testify-lint HOT 3
- ๐ค [Question]: When can the 3.0 version be applied to the production environment? HOT 3
- Explore Performance Optimization: Using a Pool for Memory Allocation in Client Package HOT 1
- Update Documentation and README.md for Client Package Refactor HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fiber.