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
- Export, Import or Migration giving this ...
As you can see in yhe screenshot i am not able to export any data or export the data from tables. Also it is affecting the migration from appwrite to appwrite h...
- Timed out waiting for runtime error
execution id 6a3e0791978712d81ee0 im having issue with appwrite function runtime performance. even after 4gbram and cpu same function sometimes completes in a...
- Project auto-blocked after load testing ...
Hi team π My project has been automatically blocked with the message: "Project is currently blocked β Access to this project is restricted. Contact support if...