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

πŸš€ Feature: Improve Error Message when Authentication is Required #80

Open
2 tasks done
stnguyen90 opened this issue Apr 19, 2023 · 2 comments
Open
2 tasks done
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@stnguyen90
Copy link
Contributor

πŸ”– Feature description

If the cookie in the pref.json is set but invalid, appwrite init project returns with:

βœ— Error User (role: guests) missing scope (projects.read)
with verbose
$ appwrite init project --verbose
? How would you like to start? Link this directory to an existing Appwrite project
AppwriteException [Error]: User (role: guests) missing scope (projects.read)
    at Client.call (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/client.js:209:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async projectsList (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/commands/projects.js:33:16)
    at async Object.choices (/Users/steven/.nvm/versions/node/v16.16.0/lib/node_modules/appwrite-cli/lib/questions.js:129:28) {
  code: 401,
  response: [Object: null prototype] {
    message: 'User (role: guests) missing scope (projects.read)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: 'dev',
    file: '/usr/src/code/app/controllers/general.php',
    line: 365,
    trace: [
      [Object: null prototype],
      [Object: null prototype],
      [Object: null prototype]
    ]
  }
}
βœ— Error User (role: guests) missing scope (projects.read)

It would be nice if the error message was more helpful. Tanmoy Karmakar has suggested:

Cannot access projects. Login is required use appwrite login command

FYI, if the cookie is not set we respond with:

βœ— Error Session not found. Please run `appwrite login` to create a session

🎀 Pitch

The current error is very technical and doesn't give the user any guidance on how to proceed. A clearer, more helpful error message will create a better developer experience.

πŸ‘€ 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?

@stnguyen90 stnguyen90 added good first issue Good for newcomers help wanted Extra attention is needed labels Apr 19, 2023
@Udassi-Pawan
Copy link

Udassi-Pawan commented Apr 20, 2023

Hey @stnguyen90 ,
I would like to work on this issue, would you assign it to me?

@stnguyen90 stnguyen90 changed the title πŸš€ Feature: Improve Error Message when Authentication is Reuqired πŸš€ Feature: Improve Error Message when Authentication is Required Apr 20, 2023
@stnguyen90
Copy link
Contributor Author

@Udassi-Pawan assigned! Thanks for your interest! πŸ™πŸΌ Remember to make the change in our sdk-generator repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants