Euler's formula, is this true?
No, in complex numbers you may not assume that $(e^a)^b=e^{(ab)}$. You just found a counter-example.
The issue that you are having is that $z^k$ can be a multivalued function, dependent on $k$. As a basic, example, we all know that $(2)^2 = 4 = (-2)^2$. So we can just as well define $4^{1/2}$ as $+2$ or $-2$.
By your argument, we can have (the clearly erroneous result) $$ -1 = e^{\pi i} = e^{2 \pi i \cdot {1 \over 2}} = (e^{2 \pi i})^{1/2} = 1^{1/2} = 1.$$ But, as with my example above, but using $(1)^2 = 1 = (-1)^2$, we see that we can define $1^{1/2}$ as either $+1$ or $-1$. The technical complex analysis term is a 'branch cut' - using one of these allows you to define $z^k$ uniquely.
I've answered a question before on a similar topic - Why do I get two different results for the reciprocal of i?.
Hopefully this answer has been helpful to you! If it has, then please remember to upvote and/or accept! Hope you understand now! :)
Following on from Yves Daoust:
$$\left(z^x\right)^y$$ $$=\left(e^{\log \left(z^x\right)}\right)^y=\left(e^{x\log \left(z\right)}\right)^y$$ $$=e^{\log \left(\left(e^{x\log \left(z\right)}\right)^y\right)}=e^{y\log \left(e^{x\log \left(z\right)}\right)}$$ $$= e^{y\left(x\log \left(z\right)+i\left(2nπ\right)\right)}$$ $$=z^{xy} ⋅ e^{i\left(2nyπ\right)}$$