The Deployment is OK, using netlify CLI to test functions works, but the moment the function is live it just keeps giving the same error.
Nov 19, 03:00:25 AM: b88bb1a6 ERROR 2024-11-19T03:00:25.792Z undefined ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'rimraf'\nRequire stack:\n- /var/task/update-inventory.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module 'rimraf'","Require stack:","- /var/task/update-inventory.mjs"," at _loadUserApp (file:///var/runtime/index.mjs:1087:17)"," at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)"," at async start (file:///var/runtime/index.mjs:1282:23)"," at async file:///var/runtime/index.mjs:1288:1"]}
Nov 19, 03:00:25 AM: b88bb1a6 ERROR INIT_REPORT Init Duration: 433.04 ms Phase: invoke Status: error Error Type: Runtime.ImportModuleError
Nov 19, 03:00:25 AM: b88bb1a6 ERROR Unknown application error occurred
Nov 19, 03:00:25 AM: b88bb1a6 ERROR Runtime.ImportModuleError
Tried with and without this netlify configuration:
[functions]
node_bundler = "esbuild"
external_node_modules = ["fs", "rimraf", "axios", "xml2js"]
To this point most of what i tried won’t work.
What am I missing in the configuration, can I even use rimraf?
The code inside this function imports a function from a .js source file in the root of the project
like this:
import { UpInventory } from "../../updateinventory"
Functions are inside a folder ‘netlify/functions’
Thanks in advance