I upgraded Azure Cosmos DB Emulator from version 1.22 to 2.0. Now when I go to the local Data Explorer, nothing loads in the Explorer tab and I see error
Failed to get authorization headers for offers: {"readyState":4,"responseText":"{\"code\":\"InternalServerError\",\"message\":\"Unknown server error occurred when processing this request.\r\nActivityId: 48afdb03-e04b-4a5e-b568-e268c32eb10f, Microsoft.Azure.Documents.Common/2.0.0.0\"}","responseJSON":{"code":"InternalServerError","message":"Unknown server error occurred when processing this request.\r\nActivityId: 48afdb03-e04b-4a5e-b568-e268c32eb10f, Microsoft.Azure.Documents.Common/2.0.0.0"},"status":500,"statusText":"error"}
I have tried reinstalling it, restarting the PC, and running it as an administrator.
What can I do to fix this?
It looks like 2.0.0 CosmosDB Emulator requires you to reset the data that's in it. That's the only thing that fixed it for me.
You can do that from the CosmosDB emulator icon
Once you reset, it will work. Also keep in mind that pre 2.0 SDKs won't work on the new emulator.
In my case, I had to uninstall / reinstall the emulator (you can download it from https://aka.ms/cosmosdb-emulator), then after a reboot I did a "Reset data..." in the emulator's context menu (as described by Nick), and afterwards it was working again.
Resetting the data alone did not do the trick in my case.
I found the following way to get it working again (Emulator Version 2.1.4.0 on Windows 10 Enterprise - Build 1803):
Notes:
"Reset data..." deletes the local Cosmos DB Emulator folder, then it stops and restarts the emulator service.
it seem to be important to start it before you start any VPN connection (e.g. the firm's VPN) - The emulator depends on the RegisteredIO APIs in addition to regular Winsockets so there can be undesired side effects with 3rd party software.
if you run the emulator on a laptop, it is recommended that you stop it before your computer enters sleep/hibernate mode. This is to ensure that the emulator’s data remains consistent and prevent you from resetting it often.
Since version 2.2.1, there is a new command line option /disablerio
that will switch the emulator to work with regular Winsockets APIs. If you encounter any issues with VPNs or 3rd party software, you can try this switch. In a command prompt (admin shell), type: cd /d "%ProgramFiles%\Azure Cosmos DB Emulator"
CosmosDB.Emulator.exe /disablerio
if you run into connect issues, check the CosmosDB emulator's SSL certificates.
Some details about the emulator
This is the directory the emulator is using:
C:\Users\[userid]\AppData\Local\CosmosDBEmulator
The application itself can be found here:
C:\Program Files\Azure Cosmos DB Emulator\Microsoft.Azure.Cosmos.Emulator.exe
While the emulator itself doesn't have many config options, there are 3 config files in the directory mentioned above: ComputeMachine.Config
, Machine.Config
and GatewayMachine.Config
.
The CosmosDB team can help if you enable the trace log. Do the following:
To collect debugging traces, run the following commands from an administrative command prompt:
cd /d "%ProgramFiles%\Azure Cosmos DB Emulator"
CosmosDB.Emulator.exe /shutdown
. Watch the system tray to make sure the program has shut down, it may take a minute. You can also just click Exit in the Azure Cosmos DB Emulator user interface.CosmosDB.Emulator.exe /starttraces
CosmosDB.Emulator.exe
CosmosDB.Emulator.exe /stoptraces
%ProgramFiles%\Azure Cosmos DB Emulator
and find the docdbemulator_000001.etl
file..etl
file along with repro steps to [email protected]
for debugging.Update: I got response from the CosmosDB dev team, which I've included in this answer. Please let me also know via comments below this answer if you found out something. Let me note that usually this tool, which I use very often for developing CosmosDB solutions, is working fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With