Tag Archives: Request failed with status code 500

Request failed with status code 500 & Self referencing loop detected for property ‘xx‘ with type

Error: request failed with status code 500, debug the front-end and back-end, and report the error “connection timeout”. Find the error self referencing loop detected for property ‘XXXX’ with type in the network

When we debug the back end step by step, we can’t find the error, but we report an error when we jump to the front end. The front end did not receive the data from the back end. Here is a summary:

**Front end receiving problems * *
the front end is receiving * * field name * * and * * type * * problems, such as name and type problems such as name, names, name: 0, name: []

 data() {
    return {
      filter: {
        name: null,
       }}},

    this.axios.get("/api/xxx/xxx").then((res) => {
    You can add a pop-up window to see if it has jumped in, jumped in is the front-end problem
    alert();
    this.name=res;
    });

**Back end problem**

When we add the * * foreign key * * of the corresponding table in the database and call * the program often uses round-trip calls, or calls the current next level and so on*

   public class User
    {
       public int id { get; set; }
       public int LoginId { get; set; }
       public Login Logins{ get; set; }
    }
    
   public class User
    {
       public int id { get; set; }
       public int UserId { get; set;}
       public User Users{ get; set; }
    }

When the data is returned to the front end after the back-end processing

public xxx
{
  var result= user.quer();
   return ok(result)
}

Pay attention to a problem at this time, or you will make the above mistakes

//When we refer to user
                // inside the class
           user --> id=1  
                      LoginId=1
                      Login =system.Login //This is generally not an error, because LoginId does not correspond to the user table

I’m afraid that at this time, your referenced class will call our class in turn to form a logical loop

           user   ——> id=1  
                      LoginId=1
                      Login =system.Login   ——>id=1
                                               UserId=1
                                               User=system.User ——>  id=1
                                                                     Login=1
                                                                     Login=system.Login ——> id=1
                                                                                            UserId=1
                                                                                            User=system.User ——>.........
                   //.................And so on and so on in a loop, but this itself has no error will not report an error..........................

Summary: when the foreign key of our user class is linked to the login class, and the login class is also linked to the user class, there happens to be a loginid value when outputting the user class, so that login also calls user, which will form a self-reference cycle and report an error

I hope the above can help you