Opta OTA Update Error

Hello, I am trying to use the Arduino Opta WiFi's OTA Update feature following the basic steps shown on the OTA page, but I keep getting an error saying that the board is not responding after reboot. I already updated the firmware and ran the partitioning examples that were recommended in other posts, but I am still stuck at this same place. I have already been successfully using the Arduino Cloud to update variables for a Thing using this device, and I can upload from Arduino Cloud's online editor via USB. Any help would be appreciated. The error is pasted below for reference. Thanks.

Over-The-Air upload available, compiling...

/usr/local/bin/arduino-cli compile --fqbn arduino:mbed_opta:opta:split=100_0,target_core=cm7,security=none --build-cache-path /tmp --output-dir /tmp/636754417/build --build-path /tmp/arduino-build-9D1F1B4A9CFF73A5DBE790914C19A930 --library /mnt/create-efs/webide/7f/2f/7f2fd4611ca5eeb45b8cd09474e9b314:andrew_dile/libraries_v2/ArduinoIoTCloud /tmp/636754417/Arduino_IDE_Soothsayer
[info] Sketch uses 734676 bytes (37%) of program storage space. Maximum is 1966080 bytes.
[info] Global variables use 99832 bytes (19%) of dynamic memory, leaving 423792 bytes for local variables. Maximum is 523624 bytes.

Over-The-Air upload request created successfully

Board error received - Unable to verify OTA: the board didn't answer after reboot

UPDATE:
It seems like it is updating, but I have to connect via USB and open the serial monitor for it to start running the program. I need it to automatically deploy the code after updating without the need of a serial connection otherwise it defeats the purpose of OTA updates. If anyone knows why this is happening or how to force it to start the program even without validation, that would be great. Any help is welcome.

Problem solved! I needed to get rid of my while (!Serial); statement for some reason and everything worked including the verification for the OTA update. I'll leave this here in case someone with a similar situation ends up needing this

Hi Andrew,
Can you share the code used on opta for ota.

Hello Muhammed,

You'll just need the Opta to be connected to Arduino Cloud and connected to your interface (linked to a Thing). The Opta's libraries for Arduino Cloud and IoT handle the OTA update automatically, so you just need to alter the sketch it auto generates when initialized, and then update via OTA or USB.

The problem I had was due to a while (!Serial) {} command rather than a simple delay(3000) line to wait for the Serial to initialize. This was causing an infinite loop because when I was doing an OTA update, it couldn't detect a USB serial connection, therefore it wouldn't continue the program, keeping it offline. This while (!Serial) {} command is not auto generated, nor good practice in my opinion, so I would steer clear of it entirely, especially in situations where the board needs to be independent after prototyping and debugging.

Hope this helps