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
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...
- Type Mismatch in AppwriteException
There is a discrepancy in the TypeScript type definitions for AppwriteException. The response property is defined as a string in the type definitions, but in pr...