Hello, I've set up a Function to delete user account completely from database.
This is my set up:
On delete account button press:
const response = await fetch("/api/deleteUser", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userId: user.$id }),
});
Which goes to api/deleteUser: (picture 1)
Then the function set up with root entry functions/deleteUserFunction/index.js (picture 2)
The entrypoint set up (picture 3)
The error i get in Function logs:
Could not load code file. Error: Cannot find module 'node-appwrite' Require stack:
- /usr/local/server/src/function/functions/deleteUserFunction/index.js
- /usr/local/server/src/server.js at Module._resolveFilename (node:internal/modules/cjs/loader:939:15) at Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/usr/local/server/src/function/functions/deleteUserFunction/index.js:1:29) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Module._load (node:internal/modules/cjs/loader:827:12) at Module.require (node:internal/modules/cjs/loader:1005:19)
Thanks for help !
And this in my package.json in functions/deleteUserFunction, it said need appwrite will install it automatically but is not working
Dont rely on appwrite to do anything automatically from what i've learned
lmao
ok i wil try that
redeploy when u change it
your entrypoint is index.js
i write just index.js as entrypoint?
since you got this error /usr/local/server/src/function/functions/deleteUserFunction/index.js
your entrypoint was/is correct. just dont copy my screenshot for entrypoint
aah ok
@AidsMcGhee Now wth is this 🤣
yeah.. run it again. ive created an issue ffor this and theyve yet to fix it. surprise lol
now back to this 🤡 🤡
did you hit the redeploy button?
yes , now i re builded it. It does the multiple internal curl
So now I re test my fucntion on my website or i redploy?
Re testing on my website made the cannot find module before again
execute it again once u get the multiple curl error
back to cannot find
AAAAAAAAAA
why they remove delete account from client 🤡
you might need to fix your build env. when i build my typescript, it outputs a main.js and package.json file with no extra folders
if package.json is not at the root of the function tar.gz the npm install won't do anything
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...