Peel and finely dice the onion and garlic. Heat the oil in a pot. Sauté onion and garlic in it. Add sugar first, then frozen cranberries. Caramelise for 4-5 minutes. Deglaze with vinegar and 150 ml water.
Bring to the boil, simmer for about 5 minutes. Season to taste with salt and pepper.