#Error `(role: applications) missing scope (rules.read)` when deploying self-hosted functions

15 messages · Page 1 of 1 (latest)

fading pilot
#

When deploying functions like this:

appwrite client --endpoint mydomain.com --project-id some-id --key some_key
appwrite push functions --all --force --verbose

I get this output:

✓ Success: Setting client
ℹ Info: Validating functions ...
ℹ Info: Checking for changes ...
ℹ Info: Pushing functions ...
⠴ Pushing      • api-handler (api_handler)                • Ignoring using: .gitignore
⠼ Creating     • user-created-handler (user_created_handler) • Ignoring using: .gitignore
⠼ Pushing      • app-config-handler (app_config_handler)  • Ignoring using: .gitignore(node:94912) ExperimentalWarning: buffer.File is an experimental✗ Error        • api-handler (api_handler)                • [email protected].
✗ Error        • user-created-handler (user_created_handler) • [email protected]
✗ Error        • app-config-handler (app_config_handler)  • [email protected]
✓ Success: Successfully pushed 3 functions.
AppwriteException [Error]: [email protected] (role: applications) missing scope (rules.read)
    at Client.call (/home/asd/.nvm/versions/node/v18.18.2/lib/node_modules/appwrite-cli/lib/client.js:211:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async proxyListRules (/home/asd/.nvm/versions/node/v18.18.2/lib/node_modules/appwrite-cli/lib/commands/proxy.js:68:16)
    at async /home/asd/.nvm/versions/node/v18.18.2/lib/node_modules/appwrite-cli/lib/commands/push.js:1235:37
    at async Promise.all (index 0)
    at async pushFunction (/home/asd/.nvm/versions/node/v18.18.2/lib/node_modules/appwrite-cli/lib/commands/push.js:1072:5) {
  code: 401,
  response: 'general_unauthorized_scope'
}

The API key i'm using for the CLI has all scopes enabled. Neither online nor in the Discord here i can find anything on a rules.read scope. The functions do get deployed (they show up in the console), but still wondering about this error. Anyone any idea? v1.6, CLI v6.1.0

soft karma
#

Hey, I am seeing the same thing. Everything appears to work fine still, but things seeming to work with an error which you can't explain doesn't sit well with me, so I would rather solve it...

What are we doing wrong here?

vague radish
vague radish
#

oh maybe it's just a console issue, the scope exists in the docs but are not shown in the API KEY Scopes view

#

for a small fix you can :

  • open the dev tools
  • add and remove a random scope
  • go in the network tab
  • copy as fetch the put request for the API KEY
  • paste it in the console tab
  • add the rules.read in the scope
    it should look something like that :
fetch("https://appwrite.example.com/v1/projects/XXX/keys/XXX", {
  "headers": {
    "accept": "*/*",
    "accept-language": "fr,fr-FR;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "cache-control": "no-cache",
    "content-type": "application/json",
    "pragma": "no-cache",
    "priority": "u=1, i",
    "sec-ch-ua": "\"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"138\", \"Microsoft Edge\";v=\"138\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Linux\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "x-appwrite-project": "console",
    "x-appwrite-response-format": "1.7.0",
    "x-sdk-language": "web",
    "x-sdk-name": "Console",
    "x-sdk-platform": "console",
    "x-sdk-version": "1.8.0"
  },
  "referrer": "https://appwrite.example.com/console/project-default-XXX/overview/keys/XXX",
  "body": "{\"name\":\"Gitlab CI\",\"scopes\":[\"databases.read\",\"databases.write\",\"collections.read\",\"collections.write\",\"attributes.read\",\"attributes.write\",\"indexes.write\",\"documents.read\",\"documents.write\",\"buckets.write\",\"functions.read\",\"functions.write\",\"targets.write\",\"providers.write\",\"topics.write\",\"sites.write\",\"rules.read\"]}",
  "method": "PUT",
  "mode": "cors",
  "credentials": "include"
});
#

tho if you edit the scopes again from the console the rules.read will be gone

sand blade
#

No news on the issue =/, still have this issue

visual fog
#

I am also waiting for a response on this.

vague radish
#

maybe for 1.9.1 ?

crude pier
# vague radish maybe for 1.9.1 ?

Randomly noticed this support thread; Indeed, we are reworking some endpoints that are currently only used by Console to be up to our quality standard, and available in Server SDK. And yes, Proxy API (rules - ability to link a domain to a resource) is one of things on my todo list 🔥

#

As of right now, you will need to use Console (in browser) or Appwrite CLI (in terminal) to setup rules. In latest CLI version I believe creating rule should work, and if not, you can ping me or Chirag to look into it

vague radish