Eclairs, or really any choux pastry, will go flat if there is any moisture left inside the pastry after cooking. This can happen if you don't dry the dough enough when you are cooking it on the stovetop or in the oven.