How is the photoelectric effect consistent with conservation laws

I have encountered quite recently the "Compton edge", which made me review the Compton effect again. A photon with wave length $\lambda$ "bumps" into a charged particle (usually an electron) and passes some of its energy to the electron, while the remaining energy goes to another photon with wavelength $\lambda '$. One can see by using conservation of energy and momentum that $$\lambda' - \lambda = \frac{h}{mc}(1-\cos \theta)$$ Where $m$ is the particle's mass and $\theta$ is the angle between the incident photon's direction and the "new photon's" direction.

From this we can see that $$\lambda \leq \lambda' \leq \lambda + \frac{2h}{mc}$$ The first inequality makes sense, because some of the energy is transferred to the electron so the wavelength can't shorten. It is equal when $\theta=0$ meaning the photon just "passed through" the electron with no interaction. The second is the what is called the "Compton edge" and it gives us a limit on how much energy can be given to the electron.

At this point I thought, how could this be consistent with the photoelectric effect? From what I know, in the photoelectric effect the whole energy is transferred to the electron and no "secondary photons" are created, which is like taking $\lambda \to \infty$, which isn't possible. So maybe this assumption that no energy going back the the electric and magnetic fields is like a photon with $\lambda \to \infty$ isn't valid, so lets attack the subject from the beginning with conservation laws:

The photon's momentum is transferred to the electron so $p=\frac{h}{\lambda}$ , but the energy is

$$\frac{hc}{\lambda} = \sqrt{(pc)^2+(mc^2)^2}$$ And this equation can't be true because $pc = \frac{hc}{\lambda}$.

What is going on? I came to the conclusion that the photoelectric effect as I understand it can't be true. What am I missing? Thank you for your help!

$$\tfrac{1}{2}m_ev_e{}^2 \le h\nu$$