I want to create an appwrite function which queries to database but i'm unable to access the database
TL;DR
User is experiencing a strange error while trying to access a database in cloud functions. They have tried setting the endpoint through code and environment variables, but the error still persists. They are using the generated index.js file from the appwrite create function command. Another user suggests checking if `client.setEndpoint()` is being called correctly. The user confirms that it is being called. Another user suggests checking if the variables are defined in the appwrite.json settings file. User confirms that they are defined. The user then shares that they are getting the endpoint as "https://HOSTNAME/v1" instead of "https://cloud.appwrite.io/v1I'm getting endpoint as "endpoint":"https://HOSTNAME/v1" although i'm setting it to : "https://cloud.appwrite.io/v1" which i think it should be.
Can you check if those are defined in appwrite.json settings file
There should be a key called variables under function object array
Yes it's there
I even tried setting them through the dashboard for this function under the environment variables
This error means client.setEndpoint() isn't being called
But how? I mean I'm using the generated index.js file from the appwrite create function command
That doesn't really matter. Look at the code and think about why client.setEndpoint() might not be called
Recommended threads