
Hello everyone, I have created a server function with all possible Node.js versions and successfully deployed it in my local Docker instance. I deployed it either via the CLI or manually. However, when executing, I always get the error: TypeError: userFunction is not a function.
Please help

This seems to be an error in your code.

This will help you to figure it out: https://stackoverflow.com/questions/33865068/typeerror-is-not-a-function-in-node-js

Well the code runs successfully locally. It fails, when i deploy it and execute it in appwrite.I

Can you show the entrypoint of the function? Also the local
appwrite version and the self hosted one.


the local appwrite version is 1.5.7

the self hosted one is also the 1.5.7 version

i meant the entrypoint in the function code.

of course this is the code of the main.js

This is not a valid Appwrite function. Please read the docs: https://appwrite.io/docs/products/functions/develop

Thanks Steven, i restructured my function, but i have an problem with bulk creating documents. I know that this topic was mentioned here in discord and github, but i wonder if there is reliable solution in appwrite itself
here is my actual code of my last etl process I have seen your comment on github, but i cannot find your suggested solution
https://github.com/appwrite/appwrite/issues/4820#issuecomment-1339983075

This fires all the create documents at the same time. It would be best to batch them 100 at a time or so

Ok i understand. I sliced the incoming array into smaller batches, but now it threw this Error.
Error creating batch 1: TypeError: fetch failed at node:internal/deps/undici/undici:12500:13 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async _Client.call (file:///usr/local/server/src/function/node_modules/node-appwrite/dist/client.mjs:263:22) at async Databases.createDocument (file:///usr/local/server/src/function/node_modules/node-appwrite/dist/services/databases.mjs:1624:12) at async Promise.all (index 0) at async loadData (file:///usr/local/server/src/function/src/etl/loadings/loadClickupData.js:32:7) at async Module.default (file:///usr/local/server/src/function/src/main.js:36:5) at async execute (/usr/local/server/src/server.js:157:22) at async action (/usr/local/server/src/server.js:174:13) at async /usr/local/server/src/server.js:10:9 { [cause]: AggregateError [ECONNREFUSED]: at internalConnectMultiple (node:net:1116:18) at afterConnectMultiple (node:net:1683:7) { code: 'ECONNREFUSED', [errors]: [ [Error], [Error] ] } } Error creating batch 2: TypeError: fetch failed

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

What did you put for your Appwrite endpoint?

Yeah this was an endpoint problem as mentioned in my other thread. You can close this thread too and marked as solved 😉 i changed the env variables and the endpoint to my local lan ip

[SOLVED] TypeError: userFunction is not a function
Recommended threads
- Functions page just got frozen when I tr...
Does someone know why this happens? would really appreaciate any help
- Reset/Recalculate Dashboard Values
Is there a way to reset/recalc this value on the dash? I had issues importing, and after my second import this was how it ended, I've since added some documents...
- Github push not triggering function depl...
I'm using appwrite cloud instance and connected my github account to appwrite successfully. I also configured the git settings of my appwrite functions. however...
