What are you trying to achieve or the steps to reproduce?
I try to use fasity with firebase function
I have setup the serverFactory and modifyCoreObjects as suggested
It is able to response on GET
but when a POST is sent, it always timeout (60 seconds)
let handleRequest;
const serverFactory = (handler, opts) => {
handleRequest = handler;
return http.createServer();
};
const app = Fastify({
serverFactory,
ignoreTrailingSlash: true,
modifyCoreObjects: false,
});
// i have notifced that this is needed or default setErrorHandler will error out of calling info with null
app.setErrorHandler((error, request, reply) => {
// log error
reply.send(error);
});
app.get('/', async (req, res) => {
return 'in pure get';
});
app.post('/', async (req, res) => {
return 'in pure post';
});
export const functionRequestHandler = (req, res) => {
app.ready(err => {
if (err) throw err;
if (handleRequest) {
handleRequest(req, res);
}
});
};
// export this to firebase function
const myapp = functions.https.onRequest(functionRequestHandler);
What was the result you received?
when i post when nothing (no content-type) i got FST_ERR_CTP_INVALID_MEDIA_TYPE
when i post when content-type = 'application/json' and body of {}
i get a timeout
What did you expect?
i expected to see text 'in pure post' responsed
Context
- node version: firebase node 6
- fastify version: >=2.2.0
- os: Mac
- any other relevant information:
What are you trying to achieve or the steps to reproduce?
I try to use fasity with firebase function
I have setup the serverFactory and modifyCoreObjects as suggested
It is able to response on GET
but when a POST is sent, it always timeout (60 seconds)
What was the result you received?
when i post when nothing (no content-type) i got FST_ERR_CTP_INVALID_MEDIA_TYPE
when i post when content-type = 'application/json' and body of {}
i get a timeout
What did you expect?
i expected to see text 'in pure post' responsed
Context