Joystick analogRead problem with Arduino Cloud

I am trying to control a servo pan-tilt connected to an esp32 with another esp32 that has a joystick connected using linked variables on Arduino Cloud. But I am having issues with the use of Arduino Cloud because whenever I upload this simple code to the esp32 that has the joystick I get the readings as normal;

int xval; 
int yval;
int buttonval;
int xpin = 13;
int ypin = 12;
int buttonpin = 14;
void setup() {
  Serial.begin(9600);
  pinMode(xpin,INPUT);
  pinMode(ypin,INPUT);
  pinMode(buttonpin,INPUT_PULLUP);
}

void loop() {
  xval=analogRead(xpin);
  yval=analogRead(ypin);
  buttonval=analogRead(buttonpin);
  Serial.print("The x value is ");
  Serial.print(xval);
  Serial.println();
  Serial.print("The y value is ");
  Serial.print(yval);
  Serial.println();
}

But when I upload the same code using the Arduino Cloud like so:

#include "arduino_secrets.h"
/* 
  Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
  https://create.arduino.cc/cloud/things/a0f1baaf-4099-486c-b962-82abd2de2c1e 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  int buttonval;
  int xval;
  int yval;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

int xpin = 13;
int ypin = 12;
int buttonpin = 14;

#include "thingProperties.h"

void setup() {

  Serial.begin(9600);
  delay(1500); 
  pinMode(xpin,INPUT);
  pinMode(ypin,INPUT);
  pinMode(buttonpin,INPUT_PULLUP);

  initProperties();

  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
xval=analogRead(xpin);
yval=analogRead(ypin);
buttonval=analogRead(buttonpin);
Serial.print("The x value is ");
Serial.print(xval);
Serial.println();
Serial.print("The y value is ");
Serial.print(yval);
Serial.println();
delay(200);
}

All I see is constantly 0 on the serial monitor. What could be the problem here?