Back

Execution permissions are not honored when invoking cloud function via REST API

  • 0
  • Flutter
  • Functions
  • Cloud
anmot.
18 Mar, 2024, 00:23

A function is created with no execution access (please refer the screenshot)

When invoking the function from client SDK, it returns user not authorized as expected AppwriteException: user_unauthorized, No permissions provided for action 'execute' (401)

When invoking the function via REST API, it ignores the permissions and invokes the function

TypeScript
curl --location 'https://<masked>.appwrite.global/' \
--header 'Content-Type: application/json' \
--data '{}'
{"code":500,"type":"InternalServerError","message":"Internal Server Error"}
TL;DR
Execution permissions were not being honored when invoking a cloud function via REST API, even though permissions were set. The issue was fixed in version 1.5.x.
Binyamin
18 Mar, 2024, 00:30

Is the error 500 is from your function?

Binyamin
18 Mar, 2024, 00:30

It sounds like a different error.

Binyamin
18 Mar, 2024, 00:31

What do you get when you going to your function in the browser? https://<masked>.appwrite.global/

anmot.
18 Mar, 2024, 00:35

Yes 500 is from my function as I'm passing empty payload.

If I do GET request or invoke in the browser, function is invoked and below error is returned from my function. Not sure why the function is invoked in the first place ignoring the permissions.

TypeScript
{"code":405,"type":"MethodNotAllowed","message":"Method Not Allowed"}
Binyamin
18 Mar, 2024, 00:39

The permission type for direct URL was added in version 1.5.x

Binyamin
18 Mar, 2024, 00:40

In version 1.4.x it will be possible to execute a function directly without any permission

Binyamin
18 Mar, 2024, 00:41

As can bee seen here

anmot.
18 Mar, 2024, 00:41

Glad it was fixed in 1.5.x. Thanks for the clarification.

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