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
- encrypt and decrypt buckets
I have a bucket where I switched from encryption to not encrypting files. I later realized that files already uploaded earlier stay encrypted. Now I have a buck...
- Unable to Create Storage After Upgrading...
We upgraded our Appwrite instance from version 1.8.0 to 1.9.0 and successfully ran the migration process. However, after the upgrade, we are no longer able to c...
- SSL certificate generation failed even t...
Hello, I have an Appwrite Site for which I added a custom domain. However, even though the domain is verified, the SSL certificate generation is failing. It is ...