I've got a problem with lambda function timing out. It times out because of zombie.js JavaScript browser.
const login = async (url, pass) => {
const Browser = require('zombie');
var browser = new Browser();
const val = await new Promise((resolve, reject) => {
browser.visit(url, () => {
browser.fill('content-protector-password', pass)
browser.pressButton('Submit', () => {
const result = browser.html('div')
resolve(result)
})
})
})
// browser.tabs.closeAll()
browser.window.close()
browser.destroy()
return val
}
I simply don't know how to exit or close this browser.
Lambda waits for that object and times out. Does any of you have an idea how to solve that problem? Even using workaround solution that would stop lambda from timing out.
Is there any generic way of getting rid of it from the memory or lambda's event loop?
PS. I've tried using context.callbackWaitsForEmptyEventLoop = false but this doesn't suit me as all other Promises are not resolved in the lambda, and basically nothing works.