
I created a function within appWrite to try to read a document. However, I come across a problem that does not show an error and the script stops working in the get_document query.
What address to access the database, for example, within an AppWrite function?
client = Client()
(client
.set_endpoint('http://127.0.0.1/v1')
.set_project('657da51f0...')
.set_key('cf2c393c430...')
)
documento = databases.get_document('657da5305d...', '657da6499df6...', context.req.body["documentId"])
Error
appwrite.exception.AppwriteException: HTTPConnectionPool(host='127.0.0.1', port=80):


Did not work.
I tried with port 80 and the port we are using is 8090
appwrite.exception.AppwriteException: HTTPConnectionPool(host='localhost', port=80): Max retries exceeded with url: /v1/databases/657da5305d3da8c5e/collections/657da6499df6b9f9/documents/6582834d7b559ee6d0 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98bc3e4220>: Failed to establish a new connection: [Errno 111] Connection refused'))
appwrite.exception.AppwriteException: HTTPConnectionPool(host='localhost', port=8089): Max retries exceeded with url: /v1/databases/657da5305d3da8c5e/collections/657da6499df6b9f9/documents/6582834d7b559ee6d0 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f98bc3e4220>: Failed to establish a new connection: [Errno 111] Connection refused'))

That's not what was suggested

And for the port it depends on what port you selected when installing Appwrite

We are using appwrite on port 8090 and it is working well for all other features.
Because we have another service using port 80
Only in this scenario to execute set_endpoint inside the function is the problem.

So use port 8090

We've tried it and it doesn't work.
I sent the result above using port 8090 as well

What exactly are you reading from what I shared?


Good...

Includes the local IP and it worked

Thanks again Steven.
We are making great progress in using all Appwrite features on our Intranet.

[SOLVED] How to run SDK modules within functions?

Good to hear!
Recommended threads
- Cannot find module failure
Sorry, Newbe question here. I just installed Appwrite and am trying to install my first Function an am having absolutely no luck what-so-ever getting this done...
- CSV Not Importing
We don’t seem to having any luck importing a simple .csv file. The import function acts like it’s working but no data imports or is shown in the collection The...
- Appwrite Cloud Custom Domains Issue
I’m trying to configure my custom domain api.kondri.lt (CNAME pointing to appwrite.network., also tried fra.cloud.appwrite.io with no luck ) but encountering a ...
