Mittelblut9/ioBroker.apple-find-me

🐛 [BUG] - Reference Error - prompt is not defined

Closed this issue · 2 comments

Description

Hi, I installed the adapter, System Debian Bookworm in a Proxmox LXC, Node 18.17.0, NPM 9, js-controller 5.0.11, Admin 6.8.2.
The installation process where fine, no faults. Start of the adapter and login into icloud are successful. ( The 2F is activated in my account, so my iphone popup and I allowed the login, but it looks like that the Adapter doesn't support this?)
Error message from iobroker:
`
2023-08-18 08:08:38.790 - info: host.iobrokerS2 iobroker url https://github.com/Mittelblut9/ioBroker.apple-find-me.git --host iobrokerS2 --debug
2023-08-18 08:08:40.203 - info: host.iobrokerS2 iobroker install Mittelblut9/ioBroker.apple-find-me#f914b1578b35066ac7f19e9340d86a11b1204cff
2023-08-18 08:08:40.494 - info: host.iobrokerS2 iobroker Installing Mittelblut9/ioBroker.apple-find-me#f914b1578b35066ac7f19e9340d86a11b1204cff... (System call)
2023-08-18 08:08:59.482 - info: host.iobrokerS2 iobroker npm WARN skipping integrity check for git dependency ssh://git@github.com/Mittelblut9/ioBroker.apple-find-me.git
2023-08-18 08:09:07.391 - info: host.iobrokerS2 iobroker upload [6] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/admin.d.ts admin.d.ts video/mp2t
2023-08-18 08:09:07.398 - info: host.iobrokerS2 iobroker upload [5] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/find-me.png find-me.png image/png
2023-08-18 08:09:07.400 - info: host.iobrokerS2 iobroker upload [4] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/help.png help.png image/png
2023-08-18 08:09:07.402 - info: host.iobrokerS2 iobroker upload [3] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/index_m.html index_m.html text/html
2023-08-18 08:09:07.404 - info: host.iobrokerS2 iobroker upload [2] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/key.png key.png image/png
2023-08-18 08:09:07.406 - info: host.iobrokerS2 iobroker upload [1] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/style.css style.css text/css
2023-08-18 08:09:07.409 - info: host.iobrokerS2 iobroker upload [0] apple-find-me.admin /opt/iobroker/node_modules/iobroker.apple-find-me/admin/words.js words.js application/javascript
2023-08-18 08:09:33.398 - info: host.iobrokerS2 iobroker add apple-find-me auto --host iobrokerS2 --debug
2023-08-18 08:09:34.519 - info: host.iobrokerS2 iobroker host.iobrokerS2 create instance apple-find-me
2023-08-18 08:09:34.523 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.alive created
2023-08-18 08:09:34.527 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.connected created
2023-08-18 08:09:34.531 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.compactMode created
2023-08-18 08:09:34.537 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.cpu created
2023-08-18 08:09:34.544 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.cputime created
2023-08-18 08:09:34.553 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.memHeapUsed created
2023-08-18 08:09:34.564 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.memHeapTotal created
2023-08-18 08:09:34.576 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.memRss created
2023-08-18 08:09:34.587 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.uptime created
2023-08-18 08:09:34.602 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.inputCount created
2023-08-18 08:09:34.619 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.outputCount created
2023-08-18 08:09:34.638 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.eventLoopLag created
2023-08-18 08:09:34.659 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.sigKill created
2023-08-18 08:09:34.680 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0.logLevel created
2023-08-18 08:09:34.704 - info: host.iobrokerS2 iobroker host.iobrokerS2 object system.adapter.apple-find-me.0 created
2023-08-18 08:11:54.307 - info: host.iobrokerS2 "system.adapter.apple-find-me.0" enabled
2023-08-18 08:11:54.362 - info: host.iobrokerS2 instance system.adapter.apple-find-me.0 started with pid 1267179
2023-08-18 08:11:55.756 - info: apple-find-me.0 (1267179) starting. Version 0.0.15 (non-npm: Mittelblut9/ioBroker.apple-find-me#f914b1578b35066ac7f19e9340d86a11b1204cff) in /opt/iobroker/node_modules/iobroker.apple-find-me, node: v18.17.0, js-controller: 5.0.11
2023-08-18 08:11:55.791 - info: apple-find-me.0 (1267179) Starting Adapter Apple-Find-Me
2023-08-18 08:11:55.792 - info: apple-find-me.0 (1267179) Refresh every 5 minutes
2023-08-18 08:11:56.116 - info: apple-find-me.0 (1267179) Logging in to iCloud...
2023-08-18 08:11:56.117 - info: apple-find-me.0 (1267179) Username: xxxxxx
2023-08-18 08:11:56.117 - info: apple-find-me.0 (1267179) Password: xxxxxxx
2023-08-18 08:11:56.132 - info: apple-find-me.0 (1267179) Trying to login with empty Session
2023-08-18 08:11:58.072 - info: apple-find-me.0 (1267179) Logged in to iCloud
2023-08-18 08:11:58.074 - error: apple-find-me.0 (1267179) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
2023-08-18 08:11:58.075 - error: apple-find-me.0 (1267179) unhandled promise rejection: prompt is not defined
2023-08-18 08:11:58.075 - error: apple-find-me.0 (1267179) ReferenceError: prompt is not defined
at handleTwoFactorAuth (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:87:22)
at iCloud. (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:50:47)
at /opt/iobroker/node_modules/apple-icloud/main.js:178:16
at /opt/iobroker/node_modules/apple-icloud/main.js:271:11
at Request._callback (/opt/iobroker/node_modules/apple-icloud/setup.js:152:9)
2023-08-18 08:11:58.076 - error: apple-find-me.0 (1267179) prompt is not defined
2023-08-18 08:11:58.077 - info: apple-find-me.0 (1267179) terminating
2023-08-18 08:11:58.078 - warn: apple-find-me.0 (1267179) Terminated (UNCAUGHT_EXCEPTION): Without reason
2023-08-18 08:11:58.579 - info: apple-find-me.0 (1267179) terminating
2023-08-18 08:11:58.620 - error: host.iobrokerS2 instance system.adapter.apple-find-me.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
2023-08-18 08:11:58.620 - info: host.iobrokerS2 Restart adapter system.adapter.apple-find-me.0 because enabled
2023-08-18 08:12:28.664 - info: host.iobrokerS2 instance system.adapter.apple-find-me.0 started with pid 1267777
2023-08-18 08:12:30.088 - info: apple-find-me.0 (1267777) starting. Version 0.0.15 (non-npm: Mittelblut9/ioBroker.apple-find-me#f914b1578b35066ac7f19e9340d86a11b1204cff) in /opt/iobroker/node_modules/iobroker.apple-find-me, node: v18.17.0, js-controller: 5.0.11
2023-08-18 08:12:30.120 - info: apple-find-me.0 (1267777) Starting Adapter Apple-Find-Me
2023-08-18 08:12:30.121 - info: apple-find-me.0 (1267777) Refresh every 5 minutes
2023-08-18 08:12:30.162 - info: apple-find-me.0 (1267777) Logging in to iCloud...
2023-08-18 08:12:30.163 - info: apple-find-me.0 (1267777) Username: xxxxx
2023-08-18 08:12:30.163 - info: apple-find-me.0 (1267777) Password: xxxxx
2023-08-18 08:12:30.178 - info: apple-find-me.0 (1267777) Trying to login with empty Session
2023-08-18 08:12:31.893 - info: apple-find-me.0 (1267777) Logged in to iCloud
2023-08-18 08:12:31.895 - error: apple-find-me.0 (1267777) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
2023-08-18 08:12:31.896 - error: apple-find-me.0 (1267777) unhandled promise rejection: prompt is not defined
2023-08-18 08:12:31.897 - error: apple-find-me.0 (1267777) ReferenceError: prompt is not defined
at handleTwoFactorAuth (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:87:22)
at iCloud. (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:50:47)
at /opt/iobroker/node_modules/apple-icloud/main.js:178:16
at /opt/iobroker/node_modules/apple-icloud/main.js:271:11
at Request._callback (/opt/iobroker/node_modules/apple-icloud/setup.js:152:9)
2023-08-18 08:12:31.897 - error: apple-find-me.0 (1267777) prompt is not defined
2023-08-18 08:12:31.899 - info: apple-find-me.0 (1267777) terminating
2023-08-18 08:12:31.899 - warn: apple-find-me.0 (1267777) Terminated (UNCAUGHT_EXCEPTION): Without reason
2023-08-18 08:12:32.401 - info: apple-find-me.0 (1267777) terminating
2023-08-18 08:12:32.443 - error: host.iobrokerS2 instance system.adapter.apple-find-me.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
2023-08-18 08:12:32.443 - info: host.iobrokerS2 Restart adapter system.adapter.apple-find-me.0 because enabled
2023-08-18 08:13:02.488 - info: host.iobrokerS2 instance system.adapter.apple-find-me.0 started with pid 1268517
2023-08-18 08:13:03.670 - info: apple-find-me.0 (1268517) starting. Version 0.0.15 (non-npm: Mittelblut9/ioBroker.apple-find-me#f914b1578b35066ac7f19e9340d86a11b1204cff) in /opt/iobroker/node_modules/iobroker.apple-find-me, node: v18.17.0, js-controller: 5.0.11
2023-08-18 08:13:03.702 - info: apple-find-me.0 (1268517) Starting Adapter Apple-Find-Me
2023-08-18 08:13:03.702 - info: apple-find-me.0 (1268517) Refresh every 5 minutes
2023-08-18 08:13:03.744 - info: apple-find-me.0 (1268517) Logging in to iCloud...
2023-08-18 08:13:03.744 - info: apple-find-me.0 (1268517) Username: xxxxxx
2023-08-18 08:13:03.745 - info: apple-find-me.0 (1268517) Password: xxxxxx
2023-08-18 08:13:03.758 - info: apple-find-me.0 (1268517) Trying to login with empty Session
2023-08-18 08:13:05.287 - info: apple-find-me.0 (1268517) Logged in to iCloud
2023-08-18 08:13:05.288 - error: apple-find-me.0 (1268517) Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
2023-08-18 08:13:05.289 - error: apple-find-me.0 (1268517) unhandled promise rejection: prompt is not defined
2023-08-18 08:13:05.289 - error: apple-find-me.0 (1268517) ReferenceError: prompt is not defined
at handleTwoFactorAuth (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:87:22)
at iCloud. (/opt/iobroker/node_modules/iobroker.apple-find-me/src/functions/Apple/loginToApple.js:50:47)
at /opt/iobroker/node_modules/apple-icloud/main.js:178:16
at /opt/iobroker/node_modules/apple-icloud/main.js:271:11
at Request._callback (/opt/iobroker/node_modules/apple-icloud/setup.js:152:9)
2023-08-18 08:13:05.290 - error: apple-find-me.0 (1268517) prompt is not defined
2023-08-18 08:13:05.291 - info: apple-find-me.0 (1268517) terminating
2023-08-18 08:13:05.292 - warn: apple-find-me.0 (1268517) Terminated (UNCAUGHT_EXCEPTION): Without reason
2023-08-18 08:13:05.792 - info: apple-find-me.0 (1268517) terminating
2023-08-18 08:13:05.835 - error: host.iobrokerS2 instance system.adapter.apple-find-me.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
2023-08-18 08:13:05.835 - info: host.iobrokerS2 Restart adapter system.adapter.apple-find-me.0 because enabled
2023-08-18 08:13:05.835 - warn: host.iobrokerS2 Do not restart adapter system.adapter.apple-find-me.0 because restart loop detected
2023-08-18 08:13:06.120 - info: email.0 (761) Send email: {"subject":"Probleme mit häufig abstürzenden Adapterinstanzen","text":"Eine Adapterinstanz stürzt beim Start häufig ab und wurde aus diesem Grund gestoppt. Die Protokolldatei muss vor dem Neustart der Instanz überprüft werden.\n\nsystem.host.iobrokerS2: \napple-find-me.0: 8/18/2023, 8:13:05 AM\n ","from":"xxxxx ","to":"xxxxx "}
2023-08-18 08:14:15.622 - info: host.iobrokerS2 "system.adapter.apple-find-me.0" disabled
apple-find-me.0: Instanz deaktiviert

`

Reproduction steps

Error appears immediately after start of the adapter.

Screenshots

DESCRIPTION

Thanks for the report. I'm already investigating the issue. 👍

I have investigated that you don't need any 2FA in the first place.

I still have added a 2FA Security Code input to ensure, that the package will send the code to the api (idk if its using it). Just to be safe somehow.

Conclusion to this issue: prompt is no longer part of the code.