My deploy is https://rdck-dev-services.netlify.app and I am running a Netlify function for Shopify on there. My functions file was working fine but then I needed to add a dependency.
const { GraphQLClient, gql } = require('graphql-request')
const fetch = require('node-fetch')
I have my package.json file in the project root… not within the function folder itself etc.
But on running the function I receive the error…
Feb 6, 01:27:17 PM: INIT_START Runtime Version: nodejs:18.v20 Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:a993d90ea43647b82f490a45d7ddd96b557b916a30128d9dcab5f4972911ec0fFeb 6, 01:27:17 PM: 2024-02-06T13:27:17.814Z undefined ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'graphql-request'\nRequire stack:\n- /var/task/netlify/functions/shopify/shopify.js\n- /var/task/shopify.js\n- /var/runtime/index.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module 'graphql-request'","Require stack:","- /var/task/netlify/functions/shopify/shopify.js","- /var/task/shopify.js","- /var/runtime/index.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"]}Feb 6, 01:27:17 PM: INIT_REPORT Init Duration: 165.06 ms Phase: init Status: error Error Type: Runtime.ExitErrorFeb 6, 01:27:18 PM: 2024-02-06T13:27:18.028Z undefined ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module 'graphql-request'\nRequire stack:\n- /var/task/netlify/functions/shopify/shopify.js\n- /var/task/shopify.js\n- /var/runtime/index.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module 'graphql-request'","Require stack:","- /var/task/netlify/functions/shopify/shopify.js","- /var/task/shopify.js","- /var/runtime/index.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"]}Feb 6, 01:27:18 PM: INIT_REPORT Init Duration: 220.53 ms Phase: invoke Status: error Error Type: Runtime.ExitErrorFeb 6, 01:27:18 PM: Unknown application error occurred
Runtime.ImportModuleErrorFeb 6, 01:27:18 PM: 0240d647 Duration: 221.81 ms Memory Usage: 17 MB
Any thoughts?