Back

Functions failing continuously!

  • 0
  • Functions
Iresharma
12 Jun, 2023, 20:00

Functions are failing continously both for python and node

TL;DR
Title: Functions failing continuously! Folder structure and code issue causing Cannot find module error. Use Appwrite CLI for easy configuration. Messages: - User provided code snippet of function. - User mentioned error: Cannot find module '/usr/code-start/index.json'. - User asked about recommended folder structure and deployment method. - User requested a quick call for assistance. - User mentioned trying the CLI but still facing issues. - User stated trying different code samples and custom logic. - Another user suggested using Appwrite CLI for automatic configuration and folder creation. - User asked about the code being used in the function. - Appreciation expressed for moving the conversation
Iresharma
12 Jun, 2023, 20:01

@D5 @Shreesh

D5
12 Jun, 2023, 20:01

Thanks for moving here! <:appwritepeepo:902865250427215882> 😄

D5
12 Jun, 2023, 20:02

Respect to your issue, what's the code you're using in your function?

D5
12 Jun, 2023, 20:02

Also, how are you creating them?

D5
12 Jun, 2023, 20:03

@Iresharma I recommend trying to use Appwrite CLI. I've thought it was going difficult configuring it, but then after trying I can confirm it is really easy to use

Iresharma
12 Jun, 2023, 20:04

ok I can try

Iresharma
12 Jun, 2023, 20:04

About the code in the function, I have tried everything from writing my custom logic to copying example from doc as weel as just a hello world

D5
12 Jun, 2023, 20:05

Probably you don't have other needed files

D5
12 Jun, 2023, 20:06

That's why I recommend installing and trying to create and deploy one with CLI since it will configure automatically everything and create all needed folder and a template too

Iresharma
12 Jun, 2023, 20:07

ok I am trying that

Iresharma
12 Jun, 2023, 20:07

thank you

Shreesh
12 Jun, 2023, 20:25

yo

Shreesh
12 Jun, 2023, 20:25

its still not working

Shreesh
12 Jun, 2023, 20:25

i tried the cli as well

Shreesh
12 Jun, 2023, 20:25

if youre free can you get on a quick call?

Iresharma
12 Jun, 2023, 20:27

@D5

Drake
12 Jun, 2023, 20:33

what's your code and what's the error?

Iresharma
12 Jun, 2023, 20:34
TypeScript
Error: Cannot find module '/usr/code-start/index.json'
Require stack:
- /usr/local/src/server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Module.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:93:18)
    at /usr/local/src/server.js:55:28
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Iresharma
12 Jun, 2023, 20:35
TypeScript
module.exports = async function (req, res) {
  // console.log("hello log")
  res.json({
    success: true
  });
};
Drake
12 Jun, 2023, 20:36

how did you deploy your function? and what's your folder structure?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more