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
- Unable to create Sites or Functions with...
Heya, I was looking at the appwrite documentation for Sites API with the server api: https://appwrite.io/docs/references/cloud/server-nodejs/sites I canβt fin...
- Triggers and call function in function p...
Hello, Today we are experiencing several issues with Appwrite Cloud. Functions triggered by events, or functions called from another function, are taking an e...
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...