Blake E
09/03/2021, 6:23 PMsls logs
right? (ie. https://www.serverless.com/framework/docs/providers/aws/cli-reference/logs/#aws---logs)Frank
sst start
, the function code is run locally, and the logs are printed in the console.Frank
sst deploy
?Blake E
09/03/2021, 6:57 PMBlake E
09/03/2021, 6:58 PMsst start
and resulting lambda from sst deploy
behave differently for me (I think it’s a reference to a static template file)
but - I’m turning on accessLogs for my api now, and wanted an easy way to tail it.Blake E
09/03/2021, 6:58 PMBlake E
09/03/2021, 6:59 PMsls logs
is that its function logGroup aware, so you can provide a simple arg like functionName
and it finds the correct loggroup to tail.Frank
Frank
Blake E
09/03/2021, 7:02 PMBlake E
09/03/2021, 7:14 PM.hbs
file not being included in lambda bundle - was using fs.readFileSync
looking at other options now, like esbuild loadersBlake E
09/03/2021, 7:14 PMENOENT: no such file or directory, open './src/table.hbs'
Frank
bundle.copyFiles
options, like this https://docs.serverless-stack.com/constructs/Function#configure-bundlingBlake E
09/03/2021, 7:16 PMBlake E
09/03/2021, 7:26 PMbundle: {
loader: {
'.hbs': 'text',
},
},
worked just fineBlake E
09/03/2021, 7:28 PMBlake E
09/03/2021, 7:44 PMlumigo-cli tail-cloudwatch-logs --namePrefix
and then added function logGroups to output for easier display and copy/pasta:
const WebAndApi = new sst.Api(this, 'WebAndApi', { routes: ... })
const functionLogGroups = WebAndApi.routes
.map((route) => {
const fn = WebAndApi.getFunction(route)
if (fn) {
return {
route,
functionName: fn.functionName,
functionArn: fn.functionArn,
logGroup: fn.logGroup.logGroupName,
}
}
return undefined
})
.filter((row) => row)
this.addOutputs({
ApiLogGroups: JSON.stringify(functionLogGroups, null, 2),
})