Firmware gets stuck at obj.printto(client) in esp32
I see that you are using SSL. SSL uses a lot of RAM and it is possible that the stack and the heap are colliding which will corrupt the running sketch. I recommend you add the amount of free heap to your log statements so that you can see how it changes, which will help you see if this is what is happening.

To obtain the free heap you can use esp_get_free_heap_size() - there's more documentation about this function in the espressif online documentation.