You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic in fiber's server when registering handlers with middleware #1469
When using the RegisterHandlersWithOptions function with middleware, a panic occurs with the message "use: invalid handler". This happens when the middleware, defined as MiddlewareFunc, is passed to Fiber's Use method. The Use method does not recognize MiddlewareFunc as a fiber.Handler, even though MiddlewareFunc is a type alias for fiber.Handler.
This issue can be reproduced by trying to register middleware with a Fiber router using the RegisterHandlersWithOptions function.
Potential Solution:
The issue seems to be due to the missing type conversion when passing the middleware function to the Use method. To fix this, the template used to generate the RegisterHandlersWithOptions function should be updated to include a type conversion for each middleware:
This explicitly converts each MiddlewareFunc to a fiber.Handler, which should ensure it's recognized as such by Use. This change could be incorporated into the RegisterHandlersWithOptions function to support middleware.
changed the title [-]Panic in Fiber's Use method due to missing type conversion when using custom middleware[/-][+]Panic in Fiber's Use method due to missing type conversion when using middleware[/+]on Feb 19, 2024
changed the title [-]Panic in Fiber's Use method due to missing type conversion when using middleware[/-][+]Panic in Fiber's server when registering handlers with middleware[/+]on Feb 19, 2024
changed the title [-]Panic in Fiber's server when registering handlers with middleware[/-][+]Panic in fiber's server when registering handlers with middleware[/+]on Feb 19, 2024
Activity
[-]Panic in Fiber's Use method due to missing type conversion when using custom middleware[/-][+]Panic in Fiber's Use method due to missing type conversion when using middleware[/+][-]Panic in Fiber's Use method due to missing type conversion when using middleware[/-][+]Panic in Fiber's server when registering handlers with middleware[/+][-]Panic in Fiber's server when registering handlers with middleware[/-][+]Panic in fiber's server when registering handlers with middleware[/+]fix: correctly register Fiber middleware
fix: correctly register Fiber middleware
fix: correctly register Fiber middleware