Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'findme') #71

Open
cookie-is-yummy opened this issue Aug 7, 2022 · 4 comments
Open

Cannot read properties of undefined (reading 'findme') #71

cookie-is-yummy opened this issue Aug 7, 2022 · 4 comments

Comments

@cookie-is-yummy
Copy link

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')'}

@guyzyl
Copy link

guyzyl commented Aug 14, 2022

I'm also experiencing this issue

@attilabalazsy
Copy link

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

@Mittelblut9
Copy link

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

@dor933
Copy link

dor933 commented Aug 18, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants