#Function execution showing guest triggering but I'm logged in?
1 messages · Page 1 of 1 (latest)
Ya that means the client doesn't have a session
but
how?
my app brings me to the login/signup screen without a session
okay I'll rebuild it
okay so I'm currently logged in
yes I'm logged in, I just checked, there's a valid user account
is it because it's not being passed to the python script or?
Oh the error is in your function? How are you authenticating in the function?
client
.set_endpoint(req.variables.get('APPWRITE_FUNCTION_ENDPOINT', None))
.set_project(req.variables.get('APPWRITE_FUNCTION_PROJECT_ID', None))
.set_key(req.variables.get('APPWRITE_FUNCTION_API_KEY', None))
.set_self_signed(True)
)
account = account.get()
if account:
print('Got account, trying to pull threads account')
I set the variables inside the appwrite.json
how do I set the execution?
Account.get() doesn't work with an API key. If you want to do something as the user who executed the function, you need to use the jwt token from the built in variables
how do I set the execution variable in the appwrite.json? I can't seem to find anything decent on it
nvm found it
so
if I use an API key
I'm forced to make it "any"?
What do you mean?
is that a security vulnerability or no because it requires the API key?
What do you mean?
using an API key, which is the default way in the docs, it has to have guests & users to run it from the server, so I was wrong about any, is that right?
yeah
An API key gives full access. If you want to do something on behalf of a user, you should use the built in JWT token
still getting this error
even though guests and users are in the scope
I click raw data and it shows me that but
When is this error occurring?
in the function somewhere
oh
could it be because
client = Client()
# You can remove services you don't use
account = Account(client)
avatars = Avatars(client)
database = Databases(client)
functions = Functions(client)
health = Health(client)
locale = Locale(client)
storage = Storage(client)
teams = Teams(client)
users = Users(client)
I left that in there in case I needed it but
that's probably causing it, yes?
well it shouldn't in theory cause I'm still authenticating with the API key but
it's occuring in execution, also I noticed the await doesn't work
maybe because I used asyncx: true
Sorry I really can't follow what you're trying to do and what's wrong
I'm trying to call a Python function from my client
basically when the user presses a button it's supposed to call this function
The function returns data back
I don't understand where you're seeing this from
the Appwrite dashboard when the function executes it fails and shows that in the raw data
ayy my name is orange now
Can you show more detail about that?
the only details I have is the following, I clicked logs on the first one and it says the second image, then I click raw data and I get the picture above
all it says in logs/errors is "internal runtime error"
the relevant section of my appwrite.json
Your function is throwing an exception. Add a try/except to make sure it doesn't throw an exception