I'm studying electromagnetism and I came upon an apparant contradiction in the calculation of the magnetic field above the center of a current loop.
The setup is given in the image, I want to calculate the magnetic field in a point above the center of the loop, at height $z$. When this is done with Biot-Savart, you get a non zero value for $B(z)\hat{z}$
I want to calculate it by first calculating the vector potential $A$ and then taking the curl of it. However when it is done in this way:
$$ A = \frac{\mu_0 I}{4 \pi} \oint \frac{d\vec{r}}{|\vec{r}-\vec{r}'|}$$
But this distance in the denominator is a constant, in the case of the loop with constant radius $R$. And thus the whole integral evaluates to $0$, so the resulting vector potential $A$ is also zero, and we get no magnetic field $B$.
How is this possible?