I have been trying to create a document from a cloud function triggered by the web console. It fails ( please check the log image) As you can see, there is "APPWRITE_FUNCTION_USER_ID: " First of all the Id "639d5549a1e8caadcc8d" does not exist anywhere..... and as per the documentation
Executions triggered in the Appwrite console will be prepended with "admin-". This does not happen and i get an ID that does not belong to any user... and that permission issue is confusing me because i thought that an execution from the server is supposed to be trusted?
here is a small code snippet
const database = new sdk.Databases(client);
console.log("Requesting for base item creation");
let baseItem = await database.createDocument(
getSterFashionDbId,
fashionItemsCollectionId,
sdk.ID.unique(),
stringifiedItemData
);
I am comfused about this... at first i thought that it was because i was in 1.2.0 but when i updated to 1.3 later on.. got the same issue
Please share more of your code
hey, I think i know where the issue was All the cloud functions were failing... I recreated the api key and they're now working as usual
now i am wondering " was it because the container was down for 2 months that the api key stopped working properly?"
Also the issue with the APPWRITE_FUNCTION_USER_ID is strange i use the following line to print it
console.log("APPWRITE_FUNCTION_USER_ID:",req.variables.APPWRITE_FUNCTION_USER_ID );
I do not have any user with that ID in my entire project...
I would only expect the API key to stop working if there was an expiration on it.
If you're executing from the console, the function user id will be the id of the console user, not a project user
They were both set to never... also the <<all>> key access time seems off.. because i changed the api key only 10/15mins ago ... but its ok the console user ID is different
i only have 2 users in the whole project, these are their Ids 63a58376581346983eec 639d6e842201d1f92738 ( logged in with this )
and this is what the console is printing 639d5549a1e8caadcc8d
If you're executing from the console, the function user id will be the id of the console user, not a project user So sorry i did not read properly , my bad π π π you were right, I understood now thanks
The last accessed at timestamp only updates after 24 hours
ow ok ok i see thanks . by the way, on this current server i have 1.2.0.. can i directly jump to 1.3.7 and run the migration?
i am currently using Gitpod on this old server.... so i can just jump to 1.3 here.... but how do i run the migration at that time π ( sorry for asking so many things... just came back from a very long break... )
You can jump to 1.3.7 and run the migration
See the docs
since i am inside gitpod and vscode, can i just switch the branch and run cd appwrite/ docker compose exec appwrite migrate
i mean i am not really sure that it would be appropriate to run
docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.3.7
when i can just change the branch??
Uhh you're running Appwrite from source??
No you're not.
Yes, this is the recommended approach but up to you
ok ok will try π thanks
thats the gitpod... once i open it, it opens vscode ( screenshot above) at that branch(1.2.0) and the browser....
can you please mark the issue as resolved ? π
You can do it yourself too by editing the post
[SOLVED] Error while trying to create a document on a cloud function
Recommended threads
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...
- Create admin user?
I'm not really sure how this is supposed to work, I installed Appwrite through docker-compose and set it up. When I launched the app and went into it, I created...