Potatoes have a high moisture content and onions release ethylene gas. They don't get along.
When kept in a moist environment, onions ripen and eventually decay, causing them to “leak”. Making matters worse, onions produce ethylene gas as they ripen encouraging surrounding produce to over-ripen. Ripening potatoes can grow eyes, shrivel up, and release more moisture. Onions and potatoes are not good roommates.
Keep your onions on the counter out of direct sunlight, or in an upper cabinet is best. You want your onions to stay cool, but not cold.
Your potatoes can be stored in a pantry or a cabinet. Do not store them in direct sunlight. This can cause the potatoes to turn green. The green color is likely chlorophyll, which is perfectly safe, but green spots can also indicate the presence of solanine, which is toxic to humans. There’s no reason to throw out the potatoes. Just cut off the green parts and remember to store your potatoes in a cool, dark place.
For more storage tips visit: https://www.wastedfoodstopswithus.org/food-waste