Bot Development in self-hosted instance
# support
y
Hi all, I am trying to call the twilio client from my self-hosted medplum bot. I've included all of the
npm
steps required in my CI/CD pipeline but when I run "execute" in the bot editor, I get this "Cannot find module" error. If the twilio module is a dependency in my package.json file and node modules, how would I deploy it to my self-hosted instance? Here is the error:
Copy code
Cannot find module 'twilio'\nRequire stack:\n- /var/task/user.js\n- /var/task/index.js\n- /var/runtime/index.mjs","trace":["Runtime.ImportModuleError: Error: Cannot find module 'twilio'","Require stack:","- /var/task/user.js","- /var/task/index.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
r
Hi @yurtric , Medplum bots ship a restricted set of dependencies, using Lambda Layers (https://www.medplum.com/docs/bots/bot-lambda-layer#introduction-to-aws-lambda-layers)
Since you are self-hosting, you can modify the the set of dependencies in the layer shipped to your lambdas
Follow the directions in the link to deploy your lambda layer (note: you'll have to set up the AWS CLI first)
179 Views