Skip to content

Instantly share code, notes, and snippets.

@soichisumi
Last active September 12, 2018 08:08
Show Gist options
  • Save soichisumi/a9a659d98f82fa6df5fe17595325053a to your computer and use it in GitHub Desktop.
Save soichisumi/a9a659d98f82fa6df5fe17595325053a to your computer and use it in GitHub Desktop.
investigate the behavior of cloud function
const functions = require(`firebase-functions`)
console.log(`func1 top`);
module.exports = functions.https.onRequest((req, res)=> {
console.log(`in func1`);
return res.status(200).send('response from func1')
});
const functions = require(`firebase-functions`);
console.log(`func2 top`);
module.exports = functions.https.onRequest((req, res)=> {
console.log(`in func2`);
return res.status(200).send('response from func2')
});
const func1 = require('./funcs/func1');
const func2 = require('./funcs/func2');
exports.func1 = func1;
exports.func2 = func2;
my_terminal % firebase deploy
my_terminal % curl https://xxxxxxxxxxxxxxx.cloudfunctions.net/func1
my_terminal % curl https://xxxxxxxxxxxxxxx.cloudfunctions.net/func1
my_terminal % firebase functions:log --only func1
2018-09-12T07:24:18.583Z I func1: func1 top
2018-09-12T07:24:18.595Z I func1: func2 top
2018-09-12T07:25:39.712Z I func1: func1 top
2018-09-12T07:25:39.725Z I func1: func2 top
2018-09-12T07:28:59.776860230Z D func1: Function execution started
2018-09-12T07:28:59.963Z I func1: in func1
2018-09-12T07:28:59.967556275Z D func1: Function execution took 191 ms, finished with status code: 200
2018-09-12T07:29:26.328540153Z D func1: Function execution started
2018-09-12T07:29:26.336Z I func1: in func1
2018-09-12T07:29:26.339260929Z D func1: Function execution took 11 ms, finished with status code: 200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment