Programing code failure or wrong GPIO pin?

Does it work with a LED in place of the relay?

I don't see a ground wire between the ESP and the relay module.

That relay module might be optically isolated so the relay closes on LOW.