chrome-aws-lambda icon indicating copy to clipboard operation
chrome-aws-lambda copied to clipboard

[BUG] A session is not maintained when link opens a new tab

Open ghost opened this issue 3 years ago • 1 comments

Environment

  • chrome-aws-lambda Version: 5.3.1
  • puppeteer / puppeteer-core Version: 5.3.1
  • OS: Linux
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

The session should be maintained when the link opens a new tab. The new page URL should be https://www.skinny.co.nz/dashboard/history/viewtopupreceipt?sessionId=dG9wdXBAY3JjZTAxNTg0NDY1NDg3MzUzODg4NDYzMDUwNzY5

Current Behavior

When the link is clicked, the new tab redirect to login page again. The new page URL is https://www.skinny.co.nz/Security/login?BackURL=%2Fdashboard%2Fhistory%2Fviewtopupreceipt%3FsessionId%3DdG9wdXBAY3JjZTAxNTg0NDY1NDg3MzUzODg4NDYzMDUwNzY5

When I tried on Windows it works, however, it doesn't work on AWS Lambda.

Steps to Reproduce

           const date = await row.$eval('td:nth-child(1)', el => el.innerText.match(/^\d{2}\/\d{2}\/\d{4}/g)[0]);
            const fileName = [date.split('/').reverse().join(''), 'Skinny', 'Tax Invoice'].join('-');
            console.log(`File Name: ${fileName}.pdf`);
            console.log(await page.cookies());

            const newPagePromise = new Promise(x => browser.once('targetcreated', target => x(target.page())));
            await row.$eval('td:nth-child(4) > a', node => node.click());
            const newPage = await newPagePromise;

            await newPage.waitForTimeout(5000);

            const content = await newPage.content();
            console.log(await newPage.cookies());
            console.log(await newPage.url());
            console.log(content);

Possible Solution

ghost avatar Oct 08 '20 19:10 ghost

@schoi1 Could you please provide a complete example so I can try to reproduce?

alixaxel avatar Nov 21 '20 23:11 alixaxel