I self hosted appwrite and created a function and deployed it on github
I get this error on function build
And this is my repo
Did you have created the repository from scratch manually?
Or used a template?
From scratch
I creatd function locally then push it to my repo
And what's the function code?
i didn't edit the code its generated with the cli
`import { Client } from 'node-appwrite';
// This is your Appwrite function // It's executed each time we get a request export default async ({ req, res, log, error }) => { // Why not try the Appwrite SDK? // // const client = new Client() // .setEndpoint('https://cloud.appwrite.io/v1') // .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID) // .setKey(process.env.APPWRITE_API_KEY);
// You can log messages to the console
// If something goes wrong, log an error error('Hello, Errors!');
// The req
object contains the request data
if (req.method === 'GET') {
// Send a response with the res object helpers
// res.send()
dispatches a string back to the client
return res.send('Hello, World!');
}
// res.json()
is a handy helper for sending JSON
return res.json({
motto: 'Build like a team of hundreds_',
learn: 'https://appwrite.io/docs',
connect: 'https://appwrite.io/discord',
getInspired: 'https://builtwith.appwrite.io',
});
};`
and this is my config is it correct ?
The code doesn't seem to return anything
You should execute the return.res.json
Like i said this is just the appwrite generated code , is this excerpted behavior ?
From the code isn't this part a return return res.send('Hello, World!');
Hey there π The error seems to be regaring tarring or untarring. This usually means issues with rootDirectory
. Can you try to rename folder to not include spaces? Let's see if that is the issue we are facing.
Hi thanks for your reply now it deployed but when excecute that code i get this error
`Could not load code file. Error: Cannot find module '/usr/local/server/src/function/main.js' Require stack:
- /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 execute (/usr/local/server/src/server.js:123:28) at /usr/local/server/src/server.js:158:33 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)`
Would you be able to create a github issue for the spaces problem?
What's your folder structure and what did you set for hte root directory and entrypoint?
Recommended threads
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Function in Node.JS to monitor events ar...
Hello everyone. I'm creating my first Node.JS function, but I don't have much experience with node and javascript. I'm trying to create a function, that monito...