@stockasyraf , your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project
See About the Installation & Troubleshooting category.
I'm not familiar with the ESP32, but I suspect that you have a power problem and the ESP board can't supply enough power to actibate the relay.
Which relay / relay module are you using?