serverless-aws-alias
serverless-aws-alias copied to clipboard
Serverless logs crashes if there are no logs available for an aliased function
If you try to show the logs for a function with serverless logs --function=XXXX [--alias=YYYY] and the aliased function has not been called (i.e. there are no log streams available for the function version), the command crashes with:
From previous event:
at persistentRequest (node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:143:38)
at AwsProvider.request (node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:159:12)
at AwsAlias.logsShowLogs (node_modules/serverless-aws-alias/lib/logs.js:117:5)
Instead of the crash, the plugin should show a proper error message like No logs found for function 'XXXX' and alias 'YYYY'
BTW: The same issue is present in the Serverless core framework - I reused the logging code in the plugin.
Thanks to @arabold for finding the issue.
Any volunteers who want to fix this? PRs appreciated.