I think the client
isn't initializing. I've added appwrite endpoint
, project_id
, and api_key
. the project_id
automatically comes from the request variable, endpoint
& api_key
are two that I've manually added from my appwrite console.
endpoint
=> https://localhost/v1
api_key
=> that I got from the API tab
I noticed the doc says that I need to use my public ip instead of https://localhost/v1
in case of cloud functions. but tbh, I don't really know what they mean by "public ip". we can find the same page on 127.0.0.1
as well. Do they want me to use https://127.0.0.1/v1
instead? if yes, then I'm not logged in there. and I also forgot my password ( i don't think we have any way to recover passwords in development mode )
I've added the code where I'm trying to access my DB and also the log of my function execution.
That's all I have. I'm not sure what I'm doing wrong. I'm new to Appwrite. So if anyone can help, that'll be appreciated.
NOTE: I'm on a Node
env
Hey there π Your code looks fine. Hmm what seems to be hapenning here is your cod egetting to catch
where you log error. For some reason, error object appears to have no public properties.
You can try to do console.log(error.toString()
instead, it might have more information for you. Also add some dummy console.log("Here")
into catch, to ensure that's where code is getting.
I can't see why it would fail, to be honest. Seeing error will be really useful
@Meldiron Hey. thanks for the toString()
suggestion. i finally see some different message. As shown in the attached, it throws a type error saying client.setEndpoint(...).setProject(...).setKey is not a function
, which is really unexpected. Cause the function-starter
node project in GitHub also uses the same approach
i just tried removing the setKey
from my code and seems now the Client
is initialized. but we face another error, saying "connect ECONNREFUSED 127.0.0.1:80". no idea what that mean
Ooh you are using appwrite
In function (in Node.JS), please use library node-appwrite
. It's adjusted a bit with server-to-server features, such as API keys or Users API
Cool. Yeah we need to provide proper IP address. With real server, that wuold be IP address of your server. With local development, you can LAN IP address of your device. You can usually find that in network settings. It's different for everyone
In future we plan to make this simpler by having internal endpoint like appwrite
, but for now, you need to provide LAN IP
thanks for the help. I've replaced appwrite
with node-appwrite
, changed the EndPoint
to my machine's IP address, and added the setKey
again. now I see a different error message. it's maybe saying that I don't have read permission for that collection. I guess it's happening cause I'm not logged in from the public IP. I'm only logged in from http://localhost
. And as I mentioned before, I forgot my console password. is there any walkaround for this? or any way to recover my pass?
What scopes did you give your api key?
i'm dumb
it's solved. thanks
[SOLVED] Appwrite sdk isn't working in the cloud function
@Steven hey. the previous problem is solved. thanks for helping with that. I was wondering if there's any way to recover my appwrite console password while being in development mode. if forgot my pass, so now I need to do many of my tasks manually
Best to create a new post
Hey @manazo can you share how you solved this?
@Steven I'm facing an issue for a similar use case. I'm creating a document inside the Appwrite function.
I've set the correct endpoint, project ID, API key with necessary scopes.
I get this error when I try to createDocument
Error: Not Found
at Client.call (/usr/code-start/node_modules/node-appwrite/lib/client.js:171:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Databases.createDocument (/usr/code-start/node_modules/node-appwrite/lib/services/databases.js:1055:16)
at async module.exports (/usr/code-start/index.js:52:24)
at async /usr/local/src/server.js:68:13```
And when I create a document from Appwrite dashboard and I try to `getDocument` I get this error
Error: app.63d65be8dbea5fcd8b44@service.192.168.29.173 (role: applications) missing scope (home) at Client.call (/usr/code-start/node_modules/node-appwrite/lib/client.js:171:31) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Databases.getDocument (/usr/code-start/node_modules/node-appwrite/lib/services/databases.js:1088:16) at async module.exports (/usr/code-start/index.js:61:24) at async /usr/local/src/server.js:68:13```
did you include /v1 in your endpoint?
I missed adding /v1/
to the endpoint π€¦ββοΈ. Apologies, that was a silly mistake.
Thanks @Steven , it's working as expected now.
Recommended threads
- Seed db
hello there... is this correct way to seed appwrite
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?