Skip to content

Unable to use Express middleware due to request type incompatible #285

@NexZhu

Description

@NexZhu

Hello

The documentations and this issue say that Express/Connect middlewares are supported but looking through the code it seems like request type is not converted to what Express middlewars expect, I see in the HttpRequest type from @deepkit/http there is no get(headerName) method from Express docs here.

With latest version of the framework "@deepkit/http": "1.0.1-alpha.71", when I tried to use this middleware: https://github.com/auth0/express-openid-connect
I got the following error:

/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/layer.js:95
    fn(req, res, next);
    ^

TypeError: req.get is not a function
    at /root/dev/web/deepkit-starter/node_modules/.pnpm/express-openid-connect@2.7.3_express@4.18.1/node_modules/express-openid-connect/lib/appSession.js:269:37
    at Layer.handle [as handle_request] (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:328:13)
    at /root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:286:9
    at Function.process_params (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:346:12)
    at next (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:280:10)
    at Function.handle (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:175:3)
    at OidcMiddleware.router [as expressOpenid] (/root/dev/web/deepkit-starter/node_modules/.pnpm/express@4.18.1/node_modules/express/lib/router/index.js:47:12)
    at OidcMiddleware.execute (/root/dev/web/deepkit-starter/src/auth/file:/root/dev/web/deepkit-starter/src/auth/oidc.ts:29:10)
    at Object.fn (eval at build (/root/dev/web/deepkit-starter/node_modules/.pnpm/@deepkit+core@1.0.1-alpha.65/node_modules/@deepkit/core/src/compiler.ts:95:20), <anonymous>:61:100)
[ERROR] 12:25:21 TypeError: req.get is not a function
Child got SIGTERM, exiting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions