Let $f:X\to Y$ be a surjective morphism of complex varieties with $Y$ affine. Assume that every fiber of this morphism has the property that all the global functions are constant.

What else do I need to assume to conclude that $f$ induces an isomorphism on global functions? Does it enough to assume that $Y$ is smooth in codimension 1?