awesome-fc/webserverless

invocation timeout upon cold start when HTTP trigger was not a GET

Opened this issue · 0 comments

was using this library to wrap my Express.js server code to work in Function compute.

const { Server } = require('@webserverless/fc-express');
const { app } = require('./app');
const server = new Server(app);

exports.handler = (req, res, context) => {
  try {
    server.httpProxy(req, res, context);
  }
  catch (e) {
    loge('handler> server.httpProxy failed:', e);
  }
};

I noticed something interesting, upon cold start, sending the following HTTP methods: POST, DELETE, PUT will caused invocation timeout, somehow the execution stuck inside this line:

server.httpProxy(req, res, context);

nothing was forwarded to my Express code.

However, if the cold start was triggered by HTTP GET first, everything would just worked subsequently. In other words, as long as the starting trigger is not HTTP GET, this library would hang until function timeout.

I'm using nodejs12 during my testing.