Back

Missing "execute" permission for role "users".

  • 0
  • Functions
  • Web
acidlake
20 Apr, 2023, 18:51

so im merging the data via a function

TL;DR
The user is experiencing errors related to missing execute permissions for the role "users". They have tried setting the async flag to false, but the issue persists. Other users suggest creating a new post for better visibility and discuss various possibilities and solutions. One suggestion is to change the function execution code to sync. It is also mentioned that guest users cannot access the `listExecutions` and `getExecution` functions. The user considers using a guest role for execution.
Binyamin
20 Apr, 2023, 18:52

Okay, I meant what function you run to execute your function?

acidlake
20 Apr, 2023, 18:53

aaah ok

acidlake
20 Apr, 2023, 18:53
acidlake
20 Apr, 2023, 18:53
acidlake
20 Apr, 2023, 18:54

the first part goes well if i add any and guest to the permissions scope, the issue is on the getExecution

Binyamin
20 Apr, 2023, 18:56

Looking into it

acidlake
20 Apr, 2023, 18:58

thanks

Binyamin
20 Apr, 2023, 19:07

🤔🤔 It's interesting and we need confirmation for that from an Appwrite core <:appwrite:637383039499894787> member. When you give a Role access to execute function, it's only for execute it.

Then the other two client-side functions listExecutions and getExecution are available only to the user who created the function. And guest can't be identified so he can never get the status of an executions.

acidlake
20 Apr, 2023, 19:09

ooh i see, and since im creating the function from the console, not the current logged in user on the dashboard that i have, so it never get the other 2 client side function permissions

Binyamin
20 Apr, 2023, 19:09

If it is true, then To solve it you can change your function execution code to sync.

Binyamin
20 Apr, 2023, 19:10

Exactly, It seems like that.

acidlake
20 Apr, 2023, 19:10

let me try with the async

acidlake
20 Apr, 2023, 19:17

it worked like this, which is weird, since the las argument was supposed to turn async on or off,

Binyamin
20 Apr, 2023, 19:17

You can see that in the database if guest runs the function then no-one ger permission to read it

Binyamin
20 Apr, 2023, 19:18

Actually it's good Because when you passed the argument false (which is the default behavior) then you'll get back the execution status in sync

Binyamin
20 Apr, 2023, 19:20

It would be nice if they would add an option for anonymous users, so you be able to run function in async.

acidlake
20 Apr, 2023, 19:22

yes, din't know the thing that user that create the function should execute it, it can run with guess, but so far i can run it with guest

acidlake
20 Apr, 2023, 19:22

so for now il use it like this, thanks for the big help

Drake
20 Apr, 2023, 20:58

what do you mean?

mav8rick
22 Aug, 2023, 19:59

Hi guys, I have set the async flag to false like:

TypeScript
    session.then(function (response) {
        console.log(response); // Success
        const functions = new Functions(client);
    
        const promise = functions.createExecution('64e459b015c232d2e51d',undefined, false);  
        
        promise.then(function (response) {
            console.log(response); // Success
        }, function (error) {
            console.log(error); // Failure
        });
    }, function (error) {
        console.log(error); // Failure
    });

But I'm still getting errors:

TypeScript
AppwriteException: Missing "execute" permission for role "user:007". Only "["any","guests"]" scopes are allowed and "["users","user:007"]" was given.
    at Client.<anonymous> (file:///D:/repo/test_appwrite/node_modules/appwrite/dist/esm/sdk.js:391:27)
    at Generator.next (<anonymous>)
    at fulfilled (file:///D:/repo/test_appwrite/node_modules/appwrite/dist/esm/sdk.js:22:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 401,
  type: 'user_unauthorized',
  response: {
    message: 'Missing "execute" permission for role "user:007". Only "["any","guests"]" scopes are allowed and "["users","user:007"]" was given.',
    code: 401,
    type: 'user_unauthorized',
    version: '1.3.7'
  }
}

Anything else I can try?

D5
22 Aug, 2023, 20:29

Did you read this thread?

D5
22 Aug, 2023, 20:29

Also, did you have tried this?

D5
22 Aug, 2023, 20:30

If that doesn't solves your issue, please, create another post

Drake
23 Aug, 2023, 00:01

Also, it's best to create a new post rather than posting in an old thread

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