Mac上のAWS SAM Local でInvalidSignatureException
Mac上の AWS SAM Local で Lambda 関数から DynamoDB Local にクエリを投げようとしたら、何故か以下のようなエラー。
An error occurred (InvalidSignatureException) when calling the Query operation: Signature not yet current: 20180520T125056Z is still later than 20180520T124759Z (20180520T123259Z + 15 min.): ClientError Traceback (most recent call last): File "/var/task/app.py", line 25, in lambda_handler (略) File "/var/runtime/botocore/paginate.py", line 255, in __iter__ response = self._make_request(current_kwargs) File "/var/runtime/botocore/paginate.py", line 332, in _make_request return self._method(**current_kwargs) File "/var/runtime/botocore/client.py", line 314, in _api_call return self._make_api_call(operation_name, kwargs) File "/var/runtime/botocore/client.py", line 612, in _make_api_call raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the Query operation: Signature not yet current: 20180520T125056Z is still later than 20180520T124759Z (20180520T123259Z + 15 min.)
実際の時刻は日本時間 21:33 頃なので、コンテナ内の時間が15分以上進んでしまっている。DynamoDB Local 側は正しい時刻で動いているので、不整合が生じているっぽい。
どうも、Docker for Mac のバグか何かで時刻がずれるらしいので、単純に Docker for Mac を一度 Restart したら解決した。
この辺では一年前くらいに直っているようだけど、スリープ以外にも原因があるのかも。
https://github.com/docker/for-mac/issues/17