Skip to content

🐛 Bug Report: Creating a user throws an error #81

@stnguyen90

Description

@stnguyen90

👟 Reproduction steps

Run:

appwrite users create --verbose \
    --userId john \
    --name John \
    --email 'john@example.com' \
    --password 'Password123'

👍 Expected behavior

The user creates successfully without errors

👎 Actual Behavior

The user is created, but an error occurs:

$ appwrite users create --verbose \
    --userId johm \
    --name John \
    --email 'john@example.com' \
    --password 'Password123'
$id : john
$createdAt : 2023-04-19T19:21:31.060+00:00
$updatedAt : 2023-04-19T19:21:31.060+00:00
name : John
password : $argon2id$v=19$m=65536,t=4,p=3$T3JlY1MuMVJhQ2o1d3k0NA$0uoV2bq2atv1SHW+GnWZaHeg+rOguKGXq5ICTPq0SN0
hash : argon2
TypeError: Cannot read properties of undefined (reading 'name')
    at parse (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/parser.js:26:52)
    at usersCreate (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/commands/users.js:87:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
✗ Error Cannot read properties of undefined (reading 'name')

using json output works fine:

$ appwrite users create --verbose --json \
    --userId john \
    --name John \
    --email 'john@example.com' \
    --password 'Password123'
{
  "$id": "john",
  "$createdAt": "2023-04-19T19:25:31.168+00:00",
  "$updatedAt": "2023-04-19T19:25:31.168+00:00",
  "name": "John",
  "password": "$argon2id$v=19$m=65536,t=4,p=3$T3AxVFJSTVJuc3p2TjFPZA$o7ux4HCf/SIVHfSmnb4la3hz9Ob/7JVyiiSoeXTU/7A",
  "hash": "argon2",
  "hashOptions": {
    "type": "argon2",
    "memoryCost": 2048,
    "timeCost": 4,
    "threads": 3
  },
  "registration": "2023-04-19T19:25:31.167+00:00",
  "status": true,
  "passwordUpdate": "2023-04-19T19:25:31.167+00:00",
  "email": "john@example.com",
  "phone": "",
  "emailVerification": false,
  "phoneVerification": false,
  "prefs": {}
}
✓ Success

It seems like the parser fails on hashOptions here:

if (data[key] && data[key].constructor.name === 'BigNumber') {

🎲 Appwrite version

Version 1.3.x

💻 Operating system

Linux

🧱 Your Environment

Used CLI version 2.0.2

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions