Uncaught (in promise): TypeError: CreateListFromArrayLike called on non-object


#1

Hello I’m getting this error ,and cant figure out the solution.When I check my code by using console.log ,everything seems ok .But I’m still getting this error.As you can see the code ,I’m trying to call 2 rest services and first one is to login user and second is to save the userid and fcm token. When I try to use response.data[“userid”] inside the second service ,im getting this error

“Uncaught (in promise): TypeError: CreateListFromArrayLike called on non-object”

Here is the code ; (all rest services are fine ,working )

this.servis.loginUser(this.username, this.password).subscribe( //services are working,no problem in here
        response => {
          if (response.data !== null) { 
            console.log("userid=" + response.data["userid"]); //this is showing in console
            this.storage.get("tokenid").then(token => { //this is working too
              this.servis.registerPush(response.data["userid"], token) //when I write a value instead of response.data["userid"] ,its working 
                .subscribe(
                  response => {
                    console.log("response :" + response);
                  },
                  err => {
                    console.log("error: " + err);
                  }
                );
              }); 
          } else {
            this.error = "user error";
          }
        },
        err => {
          console.log("__errorrrr" + err);
        }
      );