The 1.0.4 version of the ESP32 boards platform is about a year out of date. Even though I normally recommend always using the latest version, I can see that 1.0.6 is the version in use by Arduino IoT Cloud and Arduino Web Editor, so I will recommend you to use that one.
Follow these instructions to update:
- Select Tools > Board > Boards Manager from the Arduino IDE menus.
- Wait for the updates to finish.
- Scroll down through the list of boards platforms until you see "esp32 by Espressif Systems". Click on it.
- Select "1.0.6" from the "Select version" menu.
- Click the Install button.
- Wait for the installation to finish.
- Click the Close button.
Now try compiling your Thing sketch again.