microsoft / accessibility-insights-service

Accessibility Insights Service
Other
69 stars 50 forks source link

[Bug] Uncaught Error caused by too many redirects #1920

Closed DaveTryon closed 2 years ago

DaveTryon commented 2 years ago

Describe the bug

When a web page ends up in a redirect loop, an unhandled Error is created, and we end up scanning Chrome's error page. The repro steps reference an external page (https://powervirtualagents-tip.microsoft.com/en-us/en-us/) that redirects to itself. That bug may be fixed by the time that this issue is investigated, so it might be necessary to set up a different test page that redirects to itself.

Area

To Reproduce

Steps to reproduce the behavior:

  1. npm install -g accessibility-insights-scan
  2. ai-scan --maxUrls 20 --singleWorker --url https://powervirtualagents-tip.microsoft.com/en-us --crawl --restart
  3. Open the report and see that errors are flagged in chrome-error://chromewebdata/, which is not part of the web site

Expected behavior

  1. chrome-error://chromewebdata/ should not be included in the report
  2. The redirect problem should be gracefully handled and reported, but it probably doesn't belong in the accessibility report

Log files

Redacted log:

ai-scan --maxUrls 20 --singleWorker --url https://powervirtualagents-tip.microsoft.com/en-us --restart --crawl
UnhandledPromiseRejectionWarning: Error: net::ERR_TOO_MANY_REDIRECTS at https://powervirtualagents-tip.microsoft.com/en-us/en-us/
    at navigate (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:115:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async FrameManager.navigateFrame (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:90:21)
    at async Frame.goto (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:417:16)
    at async Page.goto (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:784:16)
    at async PageNavigator.navigateToUrl (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/dist/ai-scan-cli.js:6560:24)
    at async PageNavigator.navigate (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/dist/ai-scan-cli.js:6520:32)
    at async PuppeteerCrawler.PageProcessorBase.gotoFunction (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/dist/ai-scan-cli.js:4576:24)
    at async PuppeteerCrawler._handleRequestFunction (/Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/apify/build/crawlers/puppeteer_crawler.js:323:28)
    at async /Users/xx/.nvm/versions/node/v14.16.1/lib/node_modules/accessibility-insights-scan/node_modules/apify/build/utils.js:362:26
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2741) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2741) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Processing page chrome-error://chromewebdata/
Discovered 0 links on page chrome-error://chromewebdata/
Found 2 accessibility issues on page chrome-error://chromewebdata/

Screenshots

Additional context

ghost commented 2 years ago

This issue has been marked as ready for team triage; we will triage it in our weekly review and update the issue. Thank you for contributing to Accessibility Insights!