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
- proccessing problems
A database schema operation is stuck in my Frankfurt project. In the matryq database, the workspaceId attribute of the coaching_activity_entries collection rema...
- User column is processing
I am still encountering the processing tag after creating a column in my database. and its not a network or refresh issue, i have refreshed over and over, shutd...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...