i am running a puppeteer script and it seems i have to declare a mailosaur stack for me to proceed with my code. I am running a node.js script in aws cloudwatch. here is me defining the stack, and the code follows suit.
const synthetics = require('Synthetics');
const MailosaurClient = require('mailosaur');
const log = require('SyntheticsLogger');
const puppeteer = require('puppeteer-core');
const url = require('url');
const { v4: uuidv4 } = require('uuid');
await synthetics.executeStep('Assert the email was received', async function () {
const mailosaur = new MailosaurClient(`${process.env.MAILOSAUR_API_KEY}`);
const serverId = ''
const serverDomain = `${serverId}.mailosaur.net`
const searchCriteria = {
sentTo: `${patientEmailAddress}@${serverDomain}`
}
const message = await mailosaur.messages.get(serverId, searchCriteria)
const dom = new JSDOM(message.html.body);
const el = dom.window.document.querySelector('p.em_defaultlink > a');
target = el.href;
});
the error reads
RROR: Canary error: Error: Cannot find module 'mailosaur'Require stack:- /opt/nodejs/node_modules/daniels-1.js- /var/task/index.js- /var/runtime/UserFunction.js- /var/runtime/index.js Stack: Error: Cannot find module 'mailosaur'
the error says it cannot find the module mailosaur. you just need to install it.
you need to run
npm install mailosaur;