Skip to content

handler doesn't exist in routerOptions #5113

@its-dibo

Description

@its-dibo

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.24.0

Plugin version

No response

Node.js version

18

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

22

Description

Fastify docs mentioned that you can get the registered handler in onRequest hook by request.routeOptions.hndler, but there handler doesn't exist in the typeof routerOptions

 app.addHook('onRequest', (req, res, done) => {
  // Property 'handler' does not exist on type 'Readonly<RequestRouteOptions<unknown, FastifySchema>>'
    console.log( req.routeOptions.handler);
    done();
  });
};

Steps to Reproduce

.

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions