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
- Function's Static IP
Is it possible to have static. IP Address instead of Dynamic IP for getting the IP Address whitelist
- How to use dart workspaces to deploy a f...
Hello, I'm developing a Flutter application and I would like to leverage dart pub workspaces to deploy a function with a dart runtime as advertised here : http...
- [SOLVED] Unable to push function from AP...
When trying to push functions from Gitlab CI (with an API KEY and using the CLI), i saw that i was unable to push functions. ``` $ appwrite client --endpoint $...