Back

Strange error while accessing database in cloud functions

  • 1
  • Web
Nishant
30 Jul, 2023, 11:52

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/v1
Nishant
30 Jul, 2023, 11:53

I'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.

rohit90314
30 Jul, 2023, 12:26

Can you check if those are defined in appwrite.json settings file

rohit90314
30 Jul, 2023, 12:27

There should be a key called variables under function object array

Nishant
30 Jul, 2023, 13:04

Yes it's there

Nishant
30 Jul, 2023, 13:05

I even tried setting them through the dashboard for this function under the environment variables

Drake
30 Jul, 2023, 17:33

This error means client.setEndpoint() isn't being called

Nishant
30 Jul, 2023, 18:41

But how? I mean I'm using the generated index.js file from the appwrite create function command

Drake
30 Jul, 2023, 18:56

That doesn't really matter. Look at the code and think about why client.setEndpoint() might not be called

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more