Tuesday 13 August 2019

Docker for Windows Desktop clock skew: Cosmos DB "The authorization token is not valid at the current time. Please create another token and retry"

I had a containerised application that connects to my Cosmos DB emulator running on my development environment.

Sometimes when I went back to the app after a couple of days it would fail. The Cosmos DB client would error with:

"The authorization token is not valid at the current time. Please create another token and retry"

Looking at the times in the message they were earlier than the current time so that token was out of date.

Attaching to the container with:

docker exec -it <container ID> /bin/bash

I could see that the container time was indeed wrong.

Solution 1

The solution was to restart Docker for Windows desktop.

Solution 2

The other solution is to go into Hyper-V Manager, select the Linux VM, select the settings, Integration Services and then disable and then re-enable Time Synchronisation.

No comments:

Post a Comment