Preheat the oven to 350°F (175°C). Coat a 9- by 13-inch (23- by 33-cm) baking dish with nonstick spray.
In a medium bowl, use a spatula to stir together the sugar, eggs, oil, and vanilla. Add the flour, cocoa powder, baking soda, and baking powder and mix well. Fold in the zucchini until evenly distributed. Pour the mixture into the prepared baking dish.
Bake until a toothpick inserted in the center comes out with a few crumbs but no wet batter clinging to it, 35 to 50 minutes.
Let the cake cool to room temperature. Then spread the frosting on the cake, slice, and serve.
Make the chocolate buttercream frosting
In the bowl of a stand mixer fitted with the whisk attachment or in a large bowl using a handheld whisk, whisk the butter and confectioners’ sugar on medium-high speed until very pale and fluffy, about 5 minutes. Stop at least once to scrape the bowl.
With the mixer off, add the cocoa powder, vanilla, and salt. Turn the mixer on low and blend for about 30 seconds.
With the mixer running, add the heavy cream, a tablespoon at a time. When all the cream has been added and the mixture is mostly combined, remove the bowl from the mixer and scrape down the sides with a rubber spatula.
Turn the mixer to medium-high and mix until the frosting is light, fluffy, and shiny, 3 to 5 minutes.
Store in an airtight container in the refrigerator for 3 to 5 days.