Whenever I run my AI Generate through Appwrite Functions, I am getting this Call Stack AIService.generateServer (src\services\ai\gemini.ts) next (<native>) asyncGeneratorStep (node_modules@babel\runtime\helpers\asyncToGenerator.js) _next (node_modules@babel\runtime\helpers\asyncToGenerator.js) tryCallOne (address at (InternalBytecode.js:1:1180) anonymous (address at (InternalBytecode.js:1:1874) This is my terminal one Could not load code file. Error: Cannot find module '/usr/local/server/src/function/src/main.js' Require stack:
- /usr/local/server/src/server.js at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15) at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19) at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22) at Function._load (node:internal/modules/cjs/loader:1192:37) at TracingChannel.traceSync (node:diagnostics_channel:328:14) at wrapModuleLoad (node:internal/modules/cjs/loader:237:24) at Module.require (node:internal/modules/cjs/loader:1463:12) at require (node:internal/modules/helpers:147:16) at execute (/usr/local/server/src/server.js:185:22) at action (/usr/local/server/src/server.js:237:27) This is my execution log
is the package in your package.json? In your function settings, do you have npm install set?
So here's how my functions/ai_generate/package.json looks like
{
"name": "ai-generate",
"version": "1.0.0",
"description": "Appwrite Function to generate content using Gemini AI",
"main": "src/main.js",
"type": "module",
"dependencies": {
"node-fetch": "^3.3.0"
},
"engines": {
"node": ">=18.0.0"
}
}
And then functions/ai_generate/src/main.js contains my function execution code
And also the function is being deployed successfully
This is my Appwrite Console Functions Settings
And yes the npm install is set in the functions settings of Appwrite
Has your function ever worked? How did you create it? How are you deploying? What are the function path settings?
Nope it was not working since beginning
I created it from the Appwrite Console
And deploying from git
Functions path settings are automatically configured from the git one
<@788512672748535808> See I eliminated this error
Could not load code file.
Error: Cannot find module '/usr/local/server/src/function/src/main.js'
Require stack:
- /usr/local/server/src/server.js
at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
at Function._load (node:internal/modules/cjs/loader:1192:37)
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
at Module.require (node:internal/modules/cjs/loader:1463:12)
at require (node:internal/modules/helpers:147:16)
at execute (/usr/local/server/src/server.js:185:22)
at action (/usr/local/server/src/server.js:237:27)
But now facing this one
Synchronous function execution timed out. Use asynchronous execution instead, or ensure the execution duration doesn't exceed 30 seconds.\nError Code: 408
Steven if you want I can share you the link of my GitHub Repo (it's private)
So I can share you the invitation link there
Recommended threads
- Issue Related to Presence
```PresenceService: upsert error – AppwriteException: user_unauthorized, The current user is not authorized to perform the requested action. (401) ...
- Can't create or update functions via CLI...
Self-hosted 1.9.5 — all function create/update return 500: Unknown attribute: "providerBranches" (metadata ↔ physical-column desync after upgrade) Env: Appwrit...
- Refund
i started with the free version and then switch to pro and pay the fee. Before ending of the month, i switch back to free plan. got the confirmation email t...