
Hi
I am trying to call a function from my mobile app, but I am receiving "Invalid token expired."
My code looks more or less like this
// from my app
functions.createExecution(
"import-function",
JSON.stringify(data),
true,
"/",
ExecutionMethod.POST);
// my function
import { Client, Databases, ID } from "node-appwrite";
export default async ({ req, res, log, error }) => {
const client = new Client().setProject(process.env.APPWRITE_PROJECT_ID);
if (req.headers["x-appwrite-user-jwt"]) {
client.setJWT(req.headers["x-appwrite-user-jwt"]);
} else {
return res.json(
{
error:
"Access denied: This function requires authentication. Please sign in to continue.",
},
401,
);
}
// rest
}
Here more details about my code: https://jumpshare.com/s/60JUJtYCBY0F2TNsuwhH
I don't even receive 401, but I receive a 500 status code.
So, my question is: Do I send/implement something else from my app/function ?
Thanks
Recommended threads
- How do I pair Polar.sh + Hono + Appwrite...
This is what all it required by polar to see the webhook data. Managing with webhook data is not an issue, but how do I pair this all with appwrite functions st...
- The function became slower after being e...
I used the Python SDK and set `xasync=True` in `create_execution`, expecting it to execute quickly on another worker. However, the execution ended up taking sev...
- CORS errors on prod
Hi, I have an appwrite function all of a sudden it starts to give CORS errors on production environment, although it works fine but 3/5 times it gives CORS erro...
