Greetings, I love Netlify, and I have this hobby site https://tribalcouch.netlify.app
My project has 3 serverless functions that work perfectly in testing. I installed the netlify-cli locally and got everything working.
The functions require(‘faunadb’), however the Function Log shows:
{“errorType”:“Runtime.ImportModuleError”,“errorMessage”:"Error: Cannot find module ‘faunadb’\nRequire stack:\n- /var/task/netlify/functions/getContestants.js\n- /var/task/getContestants.js\n- }
Unknown application error occurred
Runtime.ImportModuleError
So fauna is installed locally but can’t be found in the serverless function?
I have it in the package.json:
{
“name”: “vs-probst”,
“private”: true,
“version”: “0.0.0”,
“type”: “module”,
“scripts”: {
“dev”: “vite”,
“build”: “vite build”,
“preview”: “vite preview”,
“netlify”: “netlify”
},
“dependencies”: {
“faunadb”: “^4.8.0”,
“netlify-cli”: “^16.4.2”,
“react”: “^18.2.0”,
“react-dom”: “^18.2.0”,
“react-router-dom”: “^6.8.1”
},
}
I have found several other discussions with similar problems but I’m unable to figure out what to do here.
I have another netlify project where there are no issues. I’m not smart enough to know if its a version problem or why else require(‘faunadb’) fails when deployed but works locally. It’s the same files.
Any tips or guidance greatly appreciated