I try to get the current logged in user on the server side, ended up with this strange error: Unable to connect. Is the computer able to access the url?
#10213
Replies: 1 comment
-
|
Hi Albert, The error "Unable to connect. Is the computer able to access the url?" usually means your function cannot reach the Appwrite API endpoint. A few things to check and try: APPWRITE_FUNCTION_API_ENDPOINT value Make sure the environment variable APPWRITE_FUNCTION_API_ENDPOINT is set correctly inside your function’s runtime environment. If it’s missing or wrong, your client will try to connect to a non-existent endpoint. Networking inside Docker So, if your Appwrite API is running on the host machine at localhost:8310, your function container likely can’t reach it via localhost. Solutions: Use Docker networking to connect containers by service name or IP instead of localhost. If your function and Appwrite run in different containers, they need to be on the same Docker network and communicate via container names. Alternatively, use the host IP or special Docker host addresses (host.docker.internal on some platforms) to reach the host from the container. Hardcoding endpoint Verify from inside the function container Summary Try setting: if your environment supports host.docker.internal. Otherwise, configure Docker networking accordingly. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It occurs on a locally deployed function (deployed to my local Docker instance). The function can be invoked from the client SDK without issues, but this code has an error.
http://localhost:8310/console/.APPWRITE_FUNCTION_API_ENDPOINThas a value ofhttp://localhost/v1, is it correct? I can not find anywhere of this value to be set. Also, tried to hard code tohttp://localhost:8310/v1, still not workVITE_APPWRITE_PUBLIC_ENDPOINT = "http://localhost:8310/v1"API Endpointin the projectSettings - Overview - API credentials:http://localhost:8310/v1On the server, the client instance is being initialized like this:
Beta Was this translation helpful? Give feedback.
All reactions