We analyze simple models of gauge mediated supersymmetry breaking in the context of supergravity. We distinguish two cases. One is when the messenger of the supersymmetry breaking is a non Abelian gauge force and the other is when the messenger is a pseudoanomalous U(1). We assume that these models originate from string theory and we impose the constraint of the vanishing of the cosmological constant requiring also the stabilization of the dilaton. In the first case, we do not find vacua that are consistent with the constraints of gauge mediation and have a zero tree level cosmological constant. In the second case, no such conflict arises. In addition, by looking at the one loop cosmological constant, we show that the dilaton F-term can not be neglected in either case. For the gauge mediated case our considerations suggest that the dilaton must be frozen out of the low energy field theory by non-perturbative string dynamics.