#x-appwrite-user-id missing from function context headers

13 messages · Page 1 of 1 (latest)

hollow sage
#

I have a python runtime function that is invoked by the frontend but when the frontend passes x-appwrite-user-id header, it appears blanked out in the function call. I have only tested this locally using the functions local dev environment

hollow sage
#

i should add i'm using anonymous login on the frontend

#

to be more precise. i am checking "context.req.headers" in the function. and the x-appwrite-user-id is an empty string

hollow sage
#

ah ok i see i need to run appwrite run functions with --user-id honestly this is pretty lame, it should grab the user id automatically if it's an appwrite cloud project.

This is also not helped by the fact that the local dev hotload is currently broken - thus leading users to assume the local server is just buggy.

so tldr: suggestion for you guys to focus on local dev flow with appwrite cloud projects, especially python

mighty ice
#

I mean, by appwrite itself

#

When you make a request form the frontend, with an authenticated user

hollow sage
#

yes that's what i realized later but it makes it difficult to simulate getting requests from different users as per later msgs. ive noticed local dev in general with appwrite is a bit clunky

mighty ice
hollow sage
#

yes i understand overwriting from client is not what we want. all i was saying is that it would be nice if the local function runtime automatically pulled in the user id from appwrite cloud if it detected those cookies present

vast snow
#

this was helpful for me on a related issue, @hollow sage thanks for asking

hollow sage
#

glad it helped @vast snow . hopefully appwrite improves their local dev flow. also, i found a way to patch the bug where local hotloading doesnt work incase they havent released that appwrite cli update yet. lmk if you run into that issue and i can maybe help

honest dune
#

You've tried createExecution?


const client = new Client();

const functions = new Functions(client);

client
    .setProject('<PROJECT_ID>') // Your project ID
;

const promise = functions.createExecution(
        '<FUNCTION_ID>',  // functionId
        '<BODY>',  // body (optional)
        false,  // async (optional)
        '<PATH>',  // path (optional)
        'GET',  // method (optional)
        {} // headers (optional)
    );

promise.then(function (response) {
    console.log(response); // Success
}, function (error) {
    console.log(error); // Failure
});