Connecting to Spark Livy issue

After running the code to connect to spark Livy, i am getting the below error in Rstudio. In the connection tab it says connected and i can see a session in spark master but the below comes after that and nothing works after that.

"status code 504 returned by rstudio server when executing connection_list _of_objects"

Code :
library(sparklyr)
library(dplyr)
library(aws.s3)

sc <- spark_connect(master = "https://livy01.np.dal.oss2.mrshmc.com",method = "livy",version = "3.3.0")