question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return null response on page with redirect

See original GitHub issue

I checked many similar issues including #2479 #4970 #1729 but no workaround or merged fix worked.

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.20
  • Platform / OS version: tested on Mac OS 10.13.6 and Last Amazon Linux 2 in Docker
  • URLs (if applicable): http://www.faalkaart.nl
  • Node.js version: v12.4.0

What steps will reproduce the problem?

Please include code that reproduces the issue.

Run this code:

const puppeteer = require('puppeteer');
const url = 'http://www.faalkaart.nl';
// const url = 'https://basisbeveiliging.nl/'; // with this it works
(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    // The following shows that redirection are followed:
    // await page.setRequestInterception(true);
    // page.on('request', r => { console.log(r._url); r.continue() });
    const response = await page.goto(url, {
        timeout: 15000,
        waitUntil: ['domcontentloaded', 'networkidle0']
    });
    // await page.waitFor(5000); // If we intercept request and wait we can see that the page is loaded but the context had been lost since response is null
    if (response) {
        console.log('Response is OK');
    } else {
        console.log('Response is null');
    } 
    await browser.close();
})();

What is the expected result?

Response is OK

What happens instead?

Response is null

Some ideas about the cause

Intercepting request I was able to see that redirection chain is

  1. http://www.faalkaart.nl/
  2. http://faalkaart.nl/
  3. https://faalkaart.nl/ <— domcontentloaded is triggered after this one
  4. https://basisbeveiliging.nl/ <— networkidle0 is triggered after this one

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:5

github_iconTop GitHub Comments

2reactions
stale[bot]commented, Jun 24, 2022

We’re marking this issue as unconfirmed because it has not had recent activity and we weren’t able to confirm it yet. It will be closed if no further activity occurs within the next 30 days.

1reaction
stale[bot]commented, Jul 24, 2022

We are closing this issue. If the issue still persists in the latest version of Puppeteer, please reopen the issue and update the description. We will try our best to accomodate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return null response on page with redirect #5011 - GitHub
launch(); const page = await browser. newPage(); // The following shows that redirection are followed: // await page. setRequestInterception( ...
Read more >
Redirect null fetch request - javascript - Stack Overflow
A value is passed through a search bar on the webpage, which is appended to a URL and used to fetch JSON data....
Read more >
Request,query string return null values in page redirect
Hi, You have called the function 'resettext();' before Response.Redirect. I think it will clear the textbox content.
Read more >
Response.Redirect and Request.UrlReferrer - MSDN - Microsoft
I have this page, say page1.aspx. I want to check from which page the user was redirected to page1. On page1 page_load I...
Read more >
Lambda@Edge example functions - Amazon CloudFront
The following example shows how to generate an HTTP redirect response with a country-specific URL and return the response to the viewer. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found