эта проблема была объяснена в Fastify несколько дней назад.
Вы можете проверить полное объяснение здесь от сопровождающих
Я опубликую здесь рабочее решение:
const functions = require('firebase-functions')
const http = require('http')
const Fastify = require('fastify')
let handleRequest = null
const serverFactory = (handler, opts) => {
handleRequest = handler
return http.createServer()
}
const fastify = Fastify({serverFactory})
fastify.get('/', (req, reply) => {
reply.send({ hello: 'world' })
})
exports.app = functions.https.onRequest((req, res) => {
req = Object.assign({ip: ''}, {...req});
fastify.ready((err) => {
if (err) throw err
handleRequest(req, res)
})
})