For local development, I’m using the Kubernetes that is included in Docker Desktop for Windows. Recently, I was playing around with the Dapr framework inside Kubernetes. I used the Dapr sidecar to connect to Azure Blob Storage (output binding) and Azure Table Storage (state store). What worked the day before, suddenly stopped working. And I really had no idea why…
The problem
While initializing the Azure Table Storage state store, Dapr threw this exception: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. No more details. During troubleshooting, I also validated if the authentication against Azure Blob Storage worked fine, because they use the same storage account. This time, I got the same runtime exception, with an extra detail: Request date header too old: ‘Mon, 08 Jun 2020 12:15:14 GMT.
The reason
Azure Storage compares the datetime inside the request with its own clock. If the time is drifting more than 15 minutes, this authentication exception is thrown. I compared the timestamp of the logs with the local time on my host machine. There was a big time difference, the clocks were not in sync. Apparently, the problem was related to Windows hibernation. When my laptop is put to sleep, the underlying Docker VM inside Hyper-V gets also hibernated. As a consequence, time synchronization doesn’t work anymore. The problem is described over here.
The solution
This blog gave me the solution. Disabling and enabling the Hyper-V time synchronization feature solves it! This can be done via this PowerShell script:
$vm = Get-VM -Name DockerDesktopVM $feature = "Time Synchronization" Disable-VMIntegrationService -vm $vm -Name $feature Enable-VMIntegrationService -vm $vm -Name $feature
I hope this saves you some troubleshooting time!
Cheers,
Toon