The following code leads to this error,
TypeScript
const account = new Account(client);
const user = await account.get();
It happens on a local deployed function (deployed to my local docker instance). The function has been invoked from the client SDK, but this code got problem.
The APPWRITE_FUNCTION_API_ENDPOINT has an value of http://localhost/v1, is it correct?
The client is being initialized like this:
TypeScript
const client = new Client()
.setEndpoint(Bun.env["APPWRITE_FUNCTION_API_ENDPOINT"])
.setProject(Bun.env["APPWRITE_FUNCTION_PROJECT_ID"])
.setKey(req.headers["x-appwrite-key"]);
// Get JWT token from headers
const jwt = req.headers["x-appwrite-user-jwt"];
if (jwt) {
client.setJWT(jwt);
}
TL;DR
Issue with connecting to the URL of a local deployed function. Error occurs with given code snippet. Check the value of `APPWRITE_FUNCTION_API_ENDPOINT` (currently set to `http://localhost/v1`). Ensure correct initialization of client and header for JWT token.Recommended threads
- i need help!
I was working on my project and I just can't stop receiving this message. Is something wrong?
- Request for JWKS Endpoint and OIDC Disco...
Hey Appwrite Team, Do you have plans to support JWKS and a well-known OIDC discovery endpoint? This would let us verify Appwrite JWTs in other services using st...
- Sites are not opening
my all sites are not opening so plz check what is the issue, when i am opening the sites showing an error like, Access to XMLHttpRequest at 'https://cloud.appw...