serverless-aws-alias icon indicating copy to clipboard operation
serverless-aws-alias copied to clipboard

Serverless logs crashes if there are no logs available for an aliased function

Open HyperBrain opened this issue 8 years ago • 1 comments

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.

HyperBrain avatar Jun 27 '17 14:06 HyperBrain

Any volunteers who want to fix this? PRs appreciated.

HyperBrain avatar Jul 05 '17 12:07 HyperBrain