Preheat the oven to 200°C (400°F).
In a large pan, melt the butter over medium heat.
Add the onion and cook until translucent, about 5 minutes.
Stir in the mushrooms and cook for another 5 minutes until they soften.
Add the flour to the pan and stir until it combines with the butter, forming a roux.
Slowly add the chicken stock, stirring continuously to avoid lumps. Allow the mixture to thicken.
Add the cooked chicken to the pan and season with salt and pepper. Stir to combine.
Roll out the puff pastry and line a pie dish with one of the sheets.
Pour the chicken and mushroom filling into the pastry-lined dish.
Cover with the second sheet of puff pastry. Seal the edges and make a few slits on top for steam to escape.
Brush the top with beaten egg.
Bake in the preheated oven for 30-35 minutes, or until the pastry is golden brown.