Sauté onions in 1 tablespoon of butter until golden. Transfer to a plate.
Prepare the green beans, by cooking in hot boiling water for 4-5 minutes, then drain and rinse with ice cold water.
To prepare the sauce: cook mushrooms in butter, seasoned with salt and pepper for 4-5 minutes, stirring frequently. Add garlic (optional) and cook for 1 minute. Add heavy cream, cream cheese, salt and pepper. Cook stirring frequently for 5 minutes, until the sauce gets creamy and there are no bug chunks of cream cheese. If you'd like to thicken the sauce, you can mix cornstarch with 2 tbsp of cold water and add it to the sauce. Stir to combine.
Grease a 9x9 baking dish (you can use a similar sized dish) with cooking spray. Add the green beans. Top with the sauce. Add cheeses and onion.
Bake for 30 minutes, until the top is bubbly.