Back

User 'targets' is coming back as boolean instead of dictionary on sign in

  • 0
  • Apple
Quasar
20 Jun, 2024, 12:17

Looks like when targets is empty it's coming back as a boolean. and the force unwrapping is causing a crash.

TypeScript
{
  "$id": "66741ca31b0639e7522d",
  "$createdAt": "2024-06-20T12:12:19.995+00:00",
  "$updatedAt": "2024-06-20T12:12:19.995+00:00",
  "name": "redacted",
  "registration": "2024-06-20T12:12:19.982+00:00",
  "status": true,
  "labels": [],
  "passwordUpdate": "2024-06-20T12:12:19.982+00:00",
  "email": "redacted",
  "phone": "",
  "emailVerification": false,
  "phoneVerification": false,
  "mfa": false,
  "prefs": {},
  "targets": [
    false
  ],
  "accessedAt": "2024-06-20T12:12:19.982+00:00"
}
TL;DR
The 'targets' property is sometimes returning as a boolean instead of a dictionary, causing a crash due to force unwrapping. This occurs when 'targets' is empty. To prevent the crash, handle the case where 'targets' is a boolean.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more