Get all your veg peeled, sliced and ready to go; grate the cheese. Grease or oil a baking sheet.
Start oven heating to 220 C / 425 F / Gas Mark 7.
Divide the puff pastry in half, roll out one piece to about 13 inches x 9 inches (35 to 20 cm), and place on the baking sheet. Leaving a 3/4 inch (2 cm) border on the outside, make a layer of onion, then potato, then cheese. Season with pepper. Brush the border you left with beaten egg.
Roll out second piece of puff pastry to be a little larger than the base. Place this over top the pie, press down the edges, then trim and crimp them.
Cut 2 or 3 slits in the top of the pie, brush all over with egg, and bake for 15 minutes. Then lower heat to 375F / 190C / gas mark 5, and cook for an additional 30 minutes until browned and cooked.
Remove from oven, let stand to cook for a few minutes, then cut into squares and serve.