I have 3 separate functions each in their own folders. All of them make use of a Twilio client and Apollo Client for dealing with SMS and GraphQL server respectively.
Rather than having all the code to instantiate each client (get keys from env etc.) in each file, can it be put somewhere and required in?
I've tried putting the code into a .js file in the top level functions/ folder and requiring it in the function code as below and this works fine locally on netlify dev but errors with Module not found '../twilioClient' when the function is called in live environment.
/functions
apolloClient.js
twilioClient.js
package.json - specifying deps used by above files
/auth
auth.js - require('../apolloClient')
...
/trails
trails.js - require('../twilioClient') etc.
...
npm initthen listing them in the top level package.json dependencies like"apollo-client": "file:./apollo-client". Again this works locally andI can reuse the modules across all functions withconst apolloClient = require('apollo-client')however same error in live environment