-
-
Save morganrallen/f955cc0312ae2cdbe9a5 to your computer and use it in GitHub Desktop.
D/CordovaActivity(18223): onMessage(onPageStarted,file:///#!/sites) | |
D/CordovaLog(18223): file:///#!/sites: Line 1 : Uncaught ReferenceError: start is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 2 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 3 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 4 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 5 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 6 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 7 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 8 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 9 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 10 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 11 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 12 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 13 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 14 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 15 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 16 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 17 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 18 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 19 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 20 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 21 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 22 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 23 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 24 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 25 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 26 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 27 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 28 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 29 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 30 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 31 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 32 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 33 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaLog(18223): file:///#!/sites: Line 34 : Uncaught ReferenceError: addRow is not defined | |
D/CordovaWebViewClient(18223): onPageFinished(file:///#!/sites) | |
D/CordovaActivity(18223): onMessage(onPageFinished,file:///#!/sites) |
Our fix involved roughly these steps (using Angular and Angular UI Router):
For Android 4.0 phonegap we:
- changed
<base href="/" >
to<base href="file:///android_asset/www/">
- disabled html5Mode for routing (
$locationProvider.html5Mode(false);
) - disabled our
!
hash prefix ($locationProvider.hashPrefix("");
) - added a route rewriter module that converts all paths that start with
file:///
but at the same time are not the homepage (file:///android_asset/www/main.html
) to
file:///android_asset/www/main.html#" + strippedUrl;
where strippedUrl means the original url withfile:///
converted to just/
and with potential/android_asset/www
converted to an empty string
As sithembiso pointed out, there seems to be an issue in the 4.0 Webview related to html5 routing and paths starting with /
.
@bornhub I am curious about the route rewriter.
You did this within angular, or as a step on the angular app build?
Would you share more details, please?
@sithembiso thaks your idea about path works for me. I could not understand why after generating .apk file from PhoneGap project my app could not load .js file, I changed path in index.html from '/js/build.js' to 'js/build.js' and problem was fixed!
Any hints you can give me, or places to begin looking?
These errors happens chromium is launched with headless: true
and with an empty argument args: [""]
passed to chromium: puppeteer/puppeteer#5737 - The default page chromium opens is invalid
These errors only happen because of the argument ""
passed to chromium and if chrome is launched with headless: true
. If headless: false
, then, no errors happen.
When I begin testings, I was directly trying to use the default page (let [page] = await browser.pages()
) instead of creating a new page with let page = await browser.newPage()
.
Trying to use the default page, caused awkward errors in the first tests trying to use the default page: TimeoutError: Timed out after 30000 ms while trying to connect to Chrome, Protocol error (Runtime.callFunctionOn): Execution context was destroyed, Error details for UnhandledPromiseRejectionWarning
(puppeteer/puppeteer#1591, puppeteer/puppeteer#4253, puppeteer/puppeteer#4651). These tests would hang forever (https://github.com/evandroforks/anki/runs/610551447?check_suite_focus=true#step:27:1649). The problem was fixed after creating a new page let page = await browser.newPage()
instead of trying to use the default page let [page] = await browser.pages()
.
If I try to print the page contents with document.body.innerHTML
nothing is output. But if I do a await page.reload()
right before, then, the page contents are printed. These problems only happen with headless: true
.
Perhaps add to the documentation to never use the default page?
What steps will reproduce the problem?
Just run: node file.js
const puppeteer = require('puppeteer');
(async () => {
let browser;
let page;
let address = process.env.SERVER_ADDRESS;
console.log("beforeAll");
browser = await puppeteer.launch({
dumpio: true,
headless: true,
args: [""],
});
let [default_page] = await browser.pages();
page = default_page;
// page = await browser.newPage();
page.on('console', async msg => console[msg._type](
...await Promise.all(msg.args().map(arg => arg.jsonValue()))
));
// await page.reload();
let contents = await default_page.evaluate(async () => String(document.body.innerHTML));
console.log('contents', contents);
browser.close()
})();
Running it on Windows results in:
2020-04-23T01:12:12.0950547Z [0423/011212.084:INFO:CONSOLE(1)] "Uncaught ReferenceError: start is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (1)
2020-04-23T01:12:12.0962301Z [0423/011212.084:INFO:CONSOLE(2)] "Uncaught ReferenceError: onHasParentDirectory is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (2)
2020-04-23T01:12:12.0963019Z [0423/011212.084:INFO:CONSOLE(3)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (3)
2020-04-23T01:12:12.0963641Z [0423/011212.084:INFO:CONSOLE(4)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (4)
2020-04-23T01:12:12.1649199Z [0423/011212.163:INFO:CONSOLE(5)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (5)
2020-04-23T01:12:12.1650694Z [0423/011212.163:INFO:CONSOLE(6)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (6)
2020-04-23T01:12:12.1662711Z [0423/011212.163:INFO:CONSOLE(7)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (7)
2020-04-23T01:12:12.1666218Z [0423/011212.163:INFO:CONSOLE(8)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (8)
2020-04-23T01:12:12.1668090Z [0423/011212.163:INFO:CONSOLE(9)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (9)
2020-04-23T01:12:12.1668876Z [0423/011212.163:INFO:CONSOLE(10)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (10)
2020-04-23T01:12:12.1669573Z [0423/011212.163:INFO:CONSOLE(11)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (11)
2020-04-23T01:12:12.1670282Z [0423/011212.163:INFO:CONSOLE(12)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (12)
2020-04-23T01:12:12.1670968Z [0423/011212.163:INFO:CONSOLE(13)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (13)
2020-04-23T01:12:12.1671655Z [0423/011212.163:INFO:CONSOLE(14)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (14)
2020-04-23T01:12:12.1672326Z [0423/011212.163:INFO:CONSOLE(15)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (15)
2020-04-23T01:12:12.1673017Z [0423/011212.163:INFO:CONSOLE(16)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (16)
2020-04-23T01:12:12.1673683Z [0423/011212.163:INFO:CONSOLE(17)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (17)
2020-04-23T01:12:12.1674367Z [0423/011212.163:INFO:CONSOLE(18)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (18)
2020-04-23T01:12:12.1675824Z [0423/011212.163:INFO:CONSOLE(19)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (19)
2020-04-23T01:12:12.1678629Z [0423/011212.163:INFO:CONSOLE(20)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (20)
2020-04-23T01:12:12.1679470Z [0423/011212.163:INFO:CONSOLE(21)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (21)
2020-04-23T01:12:12.1680160Z [0423/011212.163:INFO:CONSOLE(22)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (22)
2020-04-23T01:12:12.1680854Z [0423/011212.163:INFO:CONSOLE(23)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (23)
2020-04-23T01:12:12.1681530Z [0423/011212.163:INFO:CONSOLE(24)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (24)
2020-04-23T01:12:12.1683081Z [0423/011212.163:INFO:CONSOLE(25)] "Uncaught ReferenceError: addRow is not defined", source: file:///D:/node_modules/puppeteer/.local-chromium/win64-737027/chrome-win/ (25)
Running it on Linux results in:
0425/022342.172244:ERROR:command_buffer_proxy_impl.cc(125)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
[0425/022342.175223:INFO:CONSOLE(1)] "Uncaught ReferenceError: start is not defined", source: file:/// (1)
[0425/022342.176847:INFO:CONSOLE(2)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (2)
[0425/022342.177838:INFO:CONSOLE(3)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (3)
[0425/022342.178803:INFO:CONSOLE(4)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (4)
[0425/022342.179926:INFO:CONSOLE(5)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (5)
[0425/022342.180478:INFO:CONSOLE(6)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (6)
[0425/022342.181449:INFO:CONSOLE(7)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (7)
[0425/022342.182746:INFO:CONSOLE(8)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (8)
[0425/022342.183603:INFO:CONSOLE(9)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (9)
[0425/022342.184681:INFO:CONSOLE(10)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (10)
[0425/022342.186450:INFO:CONSOLE(11)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (11)
[0425/022342.186604:INFO:CONSOLE(12)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (12)
[0425/022342.186677:INFO:CONSOLE(13)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (13)
[0425/022342.187918:INFO:CONSOLE(14)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (14)
[0425/022342.191192:INFO:CONSOLE(15)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (15)
[0425/022342.191289:INFO:CONSOLE(16)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (16)
[0425/022342.191367:INFO:CONSOLE(17)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (17)
[0425/022342.191431:INFO:CONSOLE(18)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (18)
[0425/022342.191563:INFO:CONSOLE(19)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (19)
[0425/022342.191660:INFO:CONSOLE(20)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (20)
[0425/022342.191728:INFO:CONSOLE(21)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (21)
[0425/022342.193194:INFO:CONSOLE(22)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (22)
[0425/022342.193808:INFO:CONSOLE(23)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (23)
[0425/022342.194353:INFO:CONSOLE(24)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (24)
[0425/022342.194843:INFO:CONSOLE(25)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (25)
[0425/022342.195553:INFO:CONSOLE(26)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (26)
[0425/022342.196168:INFO:CONSOLE(27)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (27)
[0425/022342.196328:INFO:CONSOLE(28)] "Uncaught ReferenceError: addRow is not defined", source: file:/// (28)
Tell us about your environment:
- Puppeteer version: 3.0.0
- Platform / OS version: Linux Mint 19.2/Ubuntu 18.04/Windows 10
- URLs (if applicable): https://github.com/evandroforks/anki/runs/610550053?check_suite_focus=true#step:27:1601
- Node.js version: 12.16.2
After tracking down these prints, I found they located on the chromium directory_listing.cc
: https://chromium.googlesource.com/chromium/src/net/+/master/base/directory_listing.cc, https://chromium.googlesource.com/chromium/src/gpu/+/master/ipc/client/command_buffer_proxy_impl.cc, https://bugs.chromium.org/p/chromium/issues/detail?id=737678, puppeteer/puppeteer#1610 - HTML render with headless chrome + GPU hangs, puppeteer/puppeteer#1665 - async function inside evaluate fails.
Does seem to be the reason. I did a javascript search and replace because I couldn't change the web server application. It comes down to not being able to use location.href or location.reload or maybe any other location commands.