Add oil, onions, and brown sugar to a cast iron pan (or another type of pan with a thick bottom.)
Cook until onions are caramelized on medium-low heat. This can take anywhere from about 35-55 minutes. Adjust the heat as needed to prevent burning. You will need to stir more frequently as the onions cook down, to prevent burning.
Mix in the flour. Then whisk in the vegetable stock, soy sauce, and pepper. Bring to a simmer on low heat for 3 minutes before serving.