aws-sam-cli: aws-sam-cli==1.52.0 and aws-sam-translator==1.46.0 throw Error: Unable to parse the time provided by 'start-time'

Description:

When using aws-sam-cli==1.52.0 and aws-sam-translator==1.46.0 and attempting to check lambda logs using sam logs, a Error: Unable to parse the time provided by ‘start-time’

Steps to reproduce:

Run sam logs -n LambdaFunction --stack-name lambdatest --debug

Observed result:

2022-09-01 11:33:35,769 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2022-09-01 11:33:35,769 | Using config file: samconfig.toml, config environment: default
2022-09-01 11:33:35,769 | Expand command line arguments to:
2022-09-01 11:33:35,769 | --name=('LambdaFunction',) --stack_name=lambdatest --start_time=10m ago
You can now use 'sam logs' without --name parameter, which will pull the logs from all supported resources in your stack.
2022-09-01 11:33:38,976 | Template is not provided in context, skip adding project type metric
2022-09-01 11:33:38,976 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '3839790f-7da2-4d19-9aca-390c62ea54fd', 'installationId': '251d34b8-4826-4441-bbd2-e92ca2eb2033', 'sessionId': 'eaaa7dd5-1a06-43de-992a-cd16dd093594', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.4', 'samcliVersion': '1.52.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam logs', 'duration': 3207, 'exitReason': 'InvalidTimestampError', 'exitCode': 1}}]}
2022-09-01 11:33:39,180 | Telemetry response: 200
Error: Unable to parse the time provided by 'start-time'

Expected result:

2022/09/01/[$LATEST]ae674accc11240ad92e8eb1fd38fe95c 2022-09-01T11:36:33.415000 START RequestId: 8a37a681-8b13-4574-acfd-0d2ba71ae20b Version: $LATEST
2022/09/01/[$LATEST]ae674accc11240ad92e8eb1fd38fe95c 2022-09-01T11:36:34.616000 and here are the logs which iam printing from the lambda function
2022-09-01 17:07:31,168 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '', 'installationId': '', 'sessionId': '', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.52.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam logs', 'duration': 1787, 'exitReason': 'success', 'exitCode': 0}}]}

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS:Ubuntu-18.04
  2. SAM CLI version:aws-sam-cli==1.52.0 and aws-sam-translator==1.46.0
  3. AWS region:ap-south-1 4: Note: All the commands are being run in a docker container build, package,deploy worked perfectly only sam logs is causing an issue

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@MIHIRKUSH Sorry for the confusion - I was not running SAM in a container. My issue turned out to be something not right with the sam-cli package installed by Homebrew. When I used the github releases download, my unable to parse the time error went away.