Photon power issues?

I have photon connected to 10 I/O pins and powering with USB. It keeps rebooting when I added 2 digital PINS (Output and Input).

Do I need to power it with external power source? It keeps loosing communication to the cloud (blinking green ever 30 seconds).

I have two 5 volts relay connected. When I try to trip the relay the wifi connection reset and relay won’t trip

After I remove two new pins I have no more issues.

Thanks

How have you got your relays connected?
What relays are this? How much current do they draw?
Have you got flyback diodes in place?
What have you connected to all your pins?

Cloud connection loss is often caused by blocking code.
How does your code look?

@ScruffR, thanks. It was an issue with a blocking code. I forgot to take out one of the delay statements.