Skip to content

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

Open
@HyperBrain

Description

@HyperBrain

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions