Preheat oven to 350°F (175°C). Grease a 15x10x1-inch jelly roll pan or large sheet cake pan.
In a large bowl, whisk together flour, sugar, baking soda, and salt. Set aside.
In a medium saucepan, combine butter, water, and cocoa powder. Heat over medium heat, stirring until butter melts and mixture is smooth. Bring to a boil, then remove from heat.
Pour the hot chocolate mixture over the dry ingredients and stir until combined.
In a small bowl, whisk together buttermilk, eggs, and vanilla. Add to the batter and mix until smooth.
Pour batter into the prepared pan and spread evenly.
Bake for 20–25 minutes, or until a toothpick inserted in the center comes out clean.
While the cake bakes, prepare the frosting: In a saucepan, combine butter, cocoa powder, and milk. Heat over medium heat until butter melts and mixture comes to a boil.
Remove from heat and stir in vanilla and powdered sugar until smooth. Stir in pecans, if using.
Immediately pour the warm frosting over the hot cake as soon as it comes out of the oven. Spread evenly.
Allow cake to cool completely before cutting into squares.
Notes
This classic Texas Sheet Cake is best served at room temperature. Store leftovers covered at room temperature for up to 3 days.