I have a uniformly polarized infinite cylinder of radius $a$ whose axis lies along the $z$ axis with polarization vector $\vec{P} = P \vec{u_x}$, where $\vec{u_x}$ is the unit vector towards the $x$ direction, as shown in the figure, and I want to know the electric field $\vec{E}$ along the $z$ axis.
I first attempted using Gauss Law and considering the cylinder as the superposition of two cylinders separated a distance $\vec{\delta}$ with volumetric charge densities $+\rho$ and $-\rho$ respectively, and I obtained that the electric field at any point along the $z$ axis is:
$$\vec{E} = -\frac{\vec{P}}{2\epsilon_0}$$
Well, along the $z$ axis and for all positions inside the cylinder. However, I want to solve this problem as well by direct integration of the potential $\phi$ and then take its gradient to obtain the electric field, so I first obtained the superficial bound charge density as follows:
$$\sigma_b = \vec{P}\vec{u_n} = \vec{P}\vec{u{\rho}} = P\cos{\phi}$$
Where $\phi$ here means the angle between $\rho$ and the $x$ axis. Then I take the integral over the potential:
$$\vec{r} = z \vec{u_{z}}$$ $$\vec{r'} = a \vec{u_{\rho}} + z' \vec{u_{z}}$$ $$\vec{R} = \vec{r}- \vec{r'}$$ $$R^2 = (a)^2 + (z-z')^2$$
$$\phi = \frac{1}{4\pi\epsilon_0}\int\int \frac{\sigma_b}{R}da = \frac{1}{4\pi\epsilon_0}\int^{+\inf}_{-\inf}\int^{2\pi}_{0} \frac{P\cos{\phi'}}{\sqrt{(a)^2 + (z-z')^2}}d\phi'dz'$$
But then, as the integral of $\cos{\phi'}$ is zero, then the whole integral gets zero and the potential is zero, so there is no electric field. I know that this is not correct because I have calculated the electric field before with Gauss Law, but I don't understand what I am doing wrong so that I get these results. Please, could somebody tell me where is the mistake?
Thanks in advance!