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
- type generation on same columns in table
is there way to prevent this ? or only need to update column name like table prefix?
- Unable to send verification email
Hi! I’m trying to access my project on Appwrite Cloud (fra.cloud.appwrite.io), but I keep getting this popup saying: “To continue using Appwrite Cloud, please...
- Custom Topic sent from Function (with sc...
Can I send a message on a custom topic? So clients can subscribe to them?