If you run a simple example like this locally:
export async function runTimeout(req, res) {
// console.log('Request:\n\n', req);
return new Promise(async (resolve, reject) => {
await timeout(80000);
resolve();
});
res.status(200).send('Timeout complete');
}
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
Using the commands:
firebase serve --only functions
You will see that this times out at 60 seconds every time, according to the firebase github issues list the default for localhost should now stand at 9 minutes (which is the max) so their is no need to configure it. Does anyone know why I am timing out at 60 seconds vs being able to complete the full 80 seconds (as in this example) or more?
The error message is:
info: Execution took 62033 ms, finished with status: 'timeout' info: Execution took 62043 ms, finished with status: 'crash' error: Something went wrong with the function! error: Error: Can't set headers after they are sent. at validateHeader (_http_outgoing.js:491:11) at ServerResponse.setHeader (_http_outgoing.js:498:3) at ServerResponse.header (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/express/lib/response.js:767:10) at ServerResponse.send (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/express/lib/response.js:170:12) at ServerResponse.json (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/express/lib/response.js:267:15) at ProxyServer.Supervisor._proxy.on (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/supervisor/supervisor.js:107:14) at ProxyServer.emit (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/eventemitter3/index.js:144:27) at ClientRequest.proxyError (/Users/hackintosh/.nvm/versions/node/v8.11.2/lib/node_modules/firebase-tools/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:156:18) at emitOne (events.js:116:13) at ClientRequest.emit (events.js:211:7)