Webserver on WiFi Rev 2 only works when connected through usb

I have done a lot of testing on this one, and I don't think it's my code but I just got it a few days ago so what do I know. so what's happening is when I connect my Arduino Uno wifi r2 to the computer and upload the code it works fine and runs the webserver and all get requests are properly processed, but when I run it on 12v on the power jack, it will indicate from the built-in led that it has connected to the wifi and I will be able to use the webserver for like 20sec max before it just stops working. the connected indicator stays on and I check on my router's default gateway that it's still connecter too. but all the requests don't get processed from there. I tried running it from USB but selecting the wrong com port so it wouldn't connect to serial, and it did the same. just stopped after 20sec. but it seems to work totally fine when just connect to any USB power supply from the wall. maybe because it's still sending data through it idk. any help would be much appreciated, here is the code. note I got the main webserver code from somewhere else. I just modified it to fit my project.

my inputs sent to the webserver work with a type
"A" analog input
"B" binary input
"I" instruction

then they have ids and values that follow.
I send the data with GET requests.
I also have this hooked up to a small OLED screen that displays some outputs

#include <WiFiNINA.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
String state = "LED Off";

const char website[] PROGMEM = {"HTML code"};
typedef const __FlashStringHelper* FSH;

char ssid[] = "ssid";
char pass[] = "password";
int keyIndex = 0;
int status = WL_IDLE_STATUS;
int dataPos;
int scnDtaPos[3][2] = {{0, 0}, {0, 8}, {0, 17}};
String scnDtaLab[3][2] = {{"LED ", "Off"}, {"Analog: ", "50"}, {"IT: ", "--"}};
const int port = 6969;
String data;
String t;
char *dataLst[3] = {};
char *token;
char delim[] = ":";

WiFiServer server(port);
WiFiClient client = server.available();

int ledPin = 2;

void setup() {
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  screenDisplay("50", 1);

  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  while (!Serial);
  
  enable_WiFi();
  connect_WiFi();

  server.begin();
  printWifiStatus();

}

void loop() {
  client = server.available();

  if (client) {
    printWEB();
  }
}

void printWifiStatus() {
  digitalWrite(LED_BUILTIN, HIGH);
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  Serial.print("Port: ");
  Serial.println(port);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

void screenDisplay(String value, int target){
  scnDtaLab[target][1] = value;
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  for(int i=0; i < (sizeof(scnDtaPos)/sizeof(*scnDtaPos)); i++){
    display.setCursor(scnDtaPos[i][0], scnDtaPos[i][1]);
    display.println(scnDtaLab[i][0] + scnDtaLab[i][1]);
  }
  display.display();
}

void enable_WiFi() {
  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < "1.0.0") {
    Serial.println("Please upgrade the firmware");
  }
}

void connect_WiFi() {
  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
}

void getData(char ipt[]) {
  token = strtok(ipt, delim);
  for(int i=1; i <= 3; i++) {
    dataLst[i-1] = token;
    token = strtok(NULL,delim);
  }

  if (dataLst[0][0] == 'A'){
    switch ((int)dataLst[1][0]){
      case 48:
        screenDisplay((String)dataLst[2], 1);
        break;
      default:
        Serial.print("Unknown Input for A");
    }
  }else if (dataLst[0][0] == 'B'){
    switch ((int)dataLst[1][0]){
      case 48:
        if (dataLst[2][0] != 't'){
          digitalWrite(ledPin, LOW);
          screenDisplay("Off", 0);
        }else{
          digitalWrite(ledPin, HIGH);
          screenDisplay("On", 0);
        }
        break;
      case 49:
        Serial.print("Second Toggle pressed");
        break;
      default:
        Serial.print("Unknown Input for B");
    }

  }else if (dataLst[0][0] == 'I'){
    Serial.print(dataLst[0]);
      switch ((int)dataLst[1][0]){
      case 48:
        screenDisplay((String)dataLst[2], 2);
        break;
      default:
        break;
      }
  }else{
    Serial.print("Unknown Input");
    pass;
  }
}

void printWEB() {

  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out the serial monitor
        if (c == '\n') {                    // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {

            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
           
            // Send the HTML document
            client.println( (FSH) website);

            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          }
          else {      // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        }
        else if (c == '$'){
          break;
        }
        else if (c != '\r') {    // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }    
    }

    dataPos = currentLine.indexOf("?");
    if (dataPos != -1){
      data = "";
      for(int i=1; i < currentLine.length(); i++) {
        if (i > dataPos) {
          data += currentLine[i];
        }
      }
      int dataLen = data.length() + 1;
      char char_array[dataLen];
      data.toCharArray(char_array, dataLen);
      getData(char_array);
      
    }
    // close the connection:
    client.stop();
  }
}

Welcome

Maybe your 12V power supply cannot deliver enough current ?

unlikely, it's using a 2 amp power supply. had the same bad result for a 9v battery

Are there any load connected to the UNO 5 volt pin?
I suspect that and that the tiny, not heatsinked, little 12 to 5 volt onboard regulator is overloaded.
Post a wiring diagram.