Device goes offline after remaining online for a few minutes

My device remains online and functions properly but when I connect ESP32 with an external source,after a few minutes it goes offline.
P.S- I am using ESP32 with blynk it 2.0 version

this is the code:

#define BLYNK_TEMPLATE_ID "TMPLR_IHvHki"
#define BLYNK_DEVICE_NAME "Insubud"


// Fill-in information from your Blynk Template here
//#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
//#define BLYNK_DEVICE_NAME           "Device"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_WROVER_BOARD
//#define USE_TTGO_T7

#include "BlynkEdgent.h"
BlynkTimer timer;
#define button 5

void BUTTON()
{
  if(digitalRead(button)==0)
 {
    Serial.println("button is pressed");
    //delay(100);
   
    Blynk.notify ("Insulin taken");
    Blynk.logEvent("insulin_injected");
    timer.run();
 }
}

void setup()
{
  Serial.begin(115200);
  pinMode(5,INPUT);
  BlynkEdgent.begin();
  //delay(100);
}

void loop() 
{
     

    BlynkEdgent.run();
    BUTTON();
}

Serial Monitor output:


>[115] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP32

[125] --------------------------
[125] Product:  Insubud
[125] Firmware: 0.1.0 (build Jul 15 2022 00:57:44)
[136] Token:    ...WDZS
[136] Device:   ESP32 @ 240MHz
[136] MAC:      78:21:84:88:51:58
[136] Flash:    4096K
[136] ESP sdk:  v4.4.1-1-gb8050b365e
[147] Chip rev: 3
[147] Free mem: 251164
[147] --------------------------
[147] INIT => CONNECTING_NET
[158] Connecting to WiFi: LGRR Home
[2093] Using Dynamic IP: 192.168.68.118
[2093] CONNECTING_NET => CONNECTING_CLOUD
[2103] Connecting to blynk.cloud:443
[3187] Certificate OK
[3289] Ready (ping: 100ms).
[3357] CONNECTING_CLOUD => RUNNING

https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean