'problem with next firebase and typescript

I have this code I am trying to deploy next in firebase hosting using functions to achieve SSR but I just updated the versions and the current code no longer works

    import { https } from 'firebase-functions'
    import next from 'next'
    
    const isDev = process.env.NODE_ENV !== 'production'
    
    const nextjsServer = next({
        dev: isDev
    })
    
    const nextjsHandle = nextjsServer.getRequestHandler()
    
    exports.app = https.onRequest((req, res) => {
        return nextjsServer.prepare().then(() => nextjsHandle(req, res))
    })

But I get the following error

    (parameter) res: e.Response<any>
    Argument of type 'Response<any>' is not assignable to parameter of type 'ServerResponse'.
      Types of property 'req' are incompatible.
        Type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | undefined' is not assignable to type 'IncomingMessage'.
          Type 'undefined' is not assignable to type 'IncomingMessage'.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source