Hi π
After deploy a function, got this error: Could not resolve host: appwrite-executor with status code 0.
Where you getting this error exactly?
In dashboard...
π
Can you share this part of your code
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1')
OK
Hmm..
import * as sdk from "node-appwrite";
type AppwriteVariables =
| "APPWRITE_FUNCTION_ENDPOINT"
| "APPWRITE_FUNCTION_API_KEY"
| "APPWRITE_FUNCTION_ID"
| "APPWRITE_FUNCTION_PROJECT_ID"
| "APPWRITE_FUNCTION_API_KEY";
type AppwriteRequest = {
headers: { [name: string]: string };
payload: string;
variables: { [key in AppwriteVariables]: string };
};
interface AppwriteResponse {
send: (data: string, status?: number) => {};
json: (data: object, status?: number) => {};
}
module.exports = async function (req: AppwriteRequest, res: AppwriteResponse) {
const client = new sdk.Client();
const users = new sdk.Users(client);
if (
!req.variables["APPWRITE_FUNCTION_ENDPOINT"] ||
!req.variables["APPWRITE_FUNCTION_API_KEY"]
) {
throw Error(
"Environment variables are not set. Function cannot use Appwrite SDK."
);
} else {
client
.setEndpoint(req.variables["APPWRITE_FUNCTION_ENDPOINT"])
.setProject(req.variables["APPWRITE_FUNCTION_PROJECT_ID"])
.setKey(req.variables["APPWRITE_FUNCTION_API_KEY"])
.setSelfSigned(true);
}
const getAllUsers = await users.list();
res.json({ message: getAllUsers.users });
};
I have set variables in functions settings (dashboad)
That seems good
And what value you've put inside this variable? APPWRITE_FUNCTION_ENDPOINT
When try activate i got this error
Is this a self-hosted Appwrite?
Yes
Can you run
docker ps -a
And share the results?
ok
Up 2 minutes ago beacuse updated .env file, added a dart runtimes
Okay so it seems like the appwrite-executor has just been created
Can you try to execute your function now
It seems like it should work
Donβt work
Before this didnβt work, I changed the .env file because I had forgotten to add the runtime, but I tell you that it was no longer working.
Recommended threads
- Server error 500 in appwrite 1.8.0
jwt = users.create_jwt(res["userId"])["jwt"] I got this error 500 after changing environment variables and restarting containers export _APP_DOMAIN=server1.ava...
- Email templates partially broken in non-...
Good afternoon! Non-english locales are missing some variables introduced in recent releases. That makes the sent emails look bad. The issue has been raised a...
- AI feature by functions?
I'm creating a website where, in short, users can index certain genealogical content. In connection with the development of AI, I was thinking about introducing...