serverless-google-cloudfunctions
serverless-google-cloudfunctions copied to clipboard
Tailing logs for google functions ? not possible ?
Right now, if I try to tail the logs I get this:
~/D/j/s/t/f/g/ner master ± env SLS_DEBUG=true sls logs -f ner -t
Serverless: Displaying the 10 most recent log(s):
2017-04-02T21:39:51.890167280Z: Function execution took 202 ms, finished with status code: 200
2017-04-02T21:39:51.886Z: request get undefined
2017-04-02T21:39:51.886Z: request query { url: 'www.bbc.co.uk' }
2017-04-02T21:39:51.885Z: request query.url www.bbc.co.uk
2017-04-02T21:39:51.885Z: request method GET
2017-04-02T21:39:51.885Z: request body {}
2017-04-02T21:39:51.783Z: start 2017-04-02T21:39:51.783Z
2017-04-02T21:39:51.688498113Z: Function execution started
2017-04-02T21:26:35.096Z: undefined
2017-04-02T21:21:17.584056706Z: Function execution took 65 ms, finished with status code: 200
or
~/D/j/s/t/f/g/ner master ± env SLS_DEBUG=true sls logs -f ner -t
Serverless: Displaying the 10 most recent log(s):
2017-04-02T22:43:49.285375727Z: Function execution took 1574 ms, finished with status code: 200
2017-04-02T22:43:49.283Z: 3: { name: 'interest',
type: 'OTHER',
metadata: {},
salience: 0.06229871138930321,
mentions: [ { text: [Object], type: 'COMMON' } ] }
2017-04-02T22:43:49.283Z: 2: { name: 'Germany',
type: 'LOCATION',
metadata:
{ mid: '/m/0345h',
wikipedia_url: 'http://en.wikipedia.org/wiki/Germany' },
salience: 0.0702049732208252,
mentions: [ { text: [Object], type: 'PROPER' } ] }
2017-04-02T22:43:49.282Z: 1: { name: 'focus',
type: 'OTHER',
metadata: {},
salience: 0.1771026998758316,
mentions: [ { text: [Object], type: 'COMMON' } ] }
2017-04-02T22:43:49.282Z: 0: { name: 'The Americans',
type: 'WORK_OF_ART',
metadata: {},
salience: 0.6903936266899109,
mentions: [ { text: [Object], type: 'PROPER' } ] }
2017-04-02T22:43:49.280Z: Entities:
2017-04-02T22:43:47.789Z: request query.url "The Americans will shift the focus of their interest to Germany."
2017-04-02T22:43:47.789Z: request method GET
2017-04-02T22:43:47.789Z: request body {}
2017-04-02T22:43:47.783Z: start 2017-04-02T22:43:47.783Z
What I like about google functions is that unlike aws it fails to deploy if you have a syntax error or dependency not declared in package.json
:
~/D/j/s/t/f/g/ner master ± env SLS_DEBUG=true sls logs -f ner -t
Serverless: Displaying the 10 most recent log(s):
2017-04-02T22:31:14.771Z: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module '@google-cloud/vision'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/user_code/index.js:2:51)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
2017-04-02T21:47:57.997571460Z: Function execution took 112 ms, finished with status code: 200
2017-04-02T21:47:57.995Z: request query.url www.bbc.co.uk
2017-04-02T21:47:57.995Z: request method GET
2017-04-02T21:47:57.995Z: request body {}
2017-04-02T21:47:57.901Z: start 2017-04-02T21:47:57.901Z
2017-04-02T21:47:57.886143718Z: Function execution started
2017-04-02T21:39:51.890167280Z: Function execution took 202 ms, finished with status code: 200
2017-04-02T21:39:51.886Z: request get undefined
2017-04-02T21:39:51.886Z: request query { url: 'www.bbc.co.uk' }
cc @pmuens http://forum.serverless.com/t/tailing-logs-for-google-functions-not-possible/1616
@codepreneur thanks for opening! 👍
We've not added support for log tailing yet. But it's on the roadmap for the plugin.