Back

"cannot find module" error when executing function on the console.

  • 0
  • Functions
rajeshmone
25 Mar, 2023, 22:58

I am getting a cannot find module error when executing a function on the console. I am at the root of the project folder - with following structure.

  • appwrite.json
  • functions/functionName/src/index.js

Running command from terminal as below - “appwrite functions createDeployment \ --functionId=idReplaced \ --activate=true \ --entrypoint="funtionName/src/index.js" \ --code="." “ Error as below : Error: Cannot find module '/usr/code-start/functionName/src/index.js' Require stack: “ - /usr/local/src/server.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15) “

TL;DR
The user encountered a "cannot find module" error when executing a function on the console. They discovered that they had accidentally missed selecting the function name using the space key, which caused the error. The solution was to properly select the function name using the space key.
rajeshmone
25 Mar, 2023, 22:59

What is the correct "entrypoint" value in the command to point to the code

rajeshmone
25 Mar, 2023, 23:12

I got it working now. Since, I had only one function, the function name looked selected in the command line & I could not figure out that it was not. I had to select it using the "space" key. Once this is done, the function started working fine.

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