iCloud-API icon indicating copy to clipboard operation
iCloud-API copied to clipboard

Cannot read properties of undefined (reading 'findme')

Open cookie-is-yummy opened this issue 2 years ago • 4 comments

Upon running await myCloud.FindMe.get(username, password), this error pops up

Full error: TypeError: Cannot read properties of undefined (reading 'findme') at iCloud.__start (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:32:63) at Object.main.<computed> [as __start] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at iCloud.__saveGet (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:88:19) at Object.main.<computed> [as __saveGet] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at /Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:14:19 at new Promise (<anonymous>) at iCloud.get (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/apps/FindMe.js:13:26) at Object.main.<computed> [as get] (/Users/derrickw/VS Code Projects/Find My (Notifications)/node_modules/apple-icloud/resources/helper.js:84:27) at getDevices (/Users/derrickw/VS Code Projects/Find My (Notifications)/renderer.js:31:28) at processTicksAndRejections (node:internal/process/task_queues:96:5) {stack: 'TypeError: Cannot read properties of undefine…ions (node:internal/process/task_queues:96:5)', message: 'Cannot read properties of undefined (reading 'findme')'}

cookie-is-yummy avatar Aug 07 '22 07:08 cookie-is-yummy

I'm also experiencing this issue

guyzyl avatar Aug 14 '22 12:08 guyzyl

Me too. It seems, that the web service URLs are not returned or the account is not correctly initialized? Am I doing something wrong? image

attilabalazsy avatar Apr 16 '23 22:04 attilabalazsy

Hey guys. In the example code of the package, you can find this method. I tried it, and it works just fine.

const iCloud = require('apple-icloud');

const session = {}; // An empty session. Has to be a session object or file path that points on a JSON file containing your session
const username = ""; // Your apple id
const password = ""; // Your password

// This creates your iCloud instance
const myCloud = new iCloud(session, username, password);
myCloud.on("ready", async function() {
  const devices = await myCloud.FindMe.get();
  console.log(devices);
});

Response:

grafik

Mittelblut9 avatar Aug 17 '23 14:08 Mittelblut9

@Mittelblut9 It's not helps. the problem is that when it's trying to call for any of the functional methods (Calendar, FindMe.. it's doesn't matter), it's fails beacuse the Icloud object which returned has empty "account" field. and then when it's try to load it in the file, it's fails: var host = getHostFromWebservice(self.account.webservices.calendar); ("self" it's the Icloud object). I'll share my test file too, hopefully that someone will tell me what is wrong: const iCloud= require('apple-icloud'); const fs = require('fs');

console.log("runIcloud");

var username="<My_username"> var password="<My_password">

fs.writeFile("sessions/filesession.json","{}", function(err) { if(err) { return console.log(err); }

console.log("The file was saved!");

});

var myCloud= new iCloud("sessions/filesession.json", username, password);

myCloud.on('ready', async function(){

console.log("ready");
if (myCloud.twoFactorAuthenticationIsRequired) {

    console.log("twoFactorAuthenticationIsRequired");

    



  }
  else {
    console.log("You are logged in completely!");
    console.log(myCloud)
    myCloud.saveSession();
    const devices = await myCloud.FindMe.get();
    console.log(devices);
 

  }

});

*important notice: I'm always able to create the "MyCloud" object with all the details, just the "account" field within it is empty.

dor933 avatar Aug 18 '23 14:08 dor933