serverless-heaven / serverless-aws-alias

Alias support for Serverless 1.x
MIT License
189 stars 68 forks source link

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

Open HyperBrain opened 7 years ago

HyperBrain commented 7 years ago

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 commented 7 years ago

Any volunteers who want to fix this? PRs appreciated.