Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Phonegap navigate
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)
@jasonsilver
Copy link

jasonsilver commented Aug 23, 2014

I am getting these same errors on my PhoneGap app -- I haven't found a solution or cause yet, have you posted this because you have the same error, and have you found a workaround?

Any hints you can give me, or places to begin looking?

Thanks!
Jason Silver

[code]
Uncaught ReferenceError: start is not defined (index):1
(anonymous function) (index):1
Uncaught ReferenceError: addRow is not defined (index):2
(anonymous function) (index):2
Uncaught ReferenceError: addRow is not defined (index):3
(anonymous function) (index):3
Uncaught ReferenceError: addRow is not defined (index):4
Uncaught ReferenceError: addRow is not defined (index):5
Uncaught ReferenceError: addRow is not defined (index):6
Uncaught ReferenceError: addRow is not defined (index):7
Uncaught ReferenceError: addRow is not defined (index):8
Uncaught ReferenceError: addRow is not defined (index):9
Uncaught ReferenceError: addRow is not defined (index):10
Uncaught ReferenceError: addRow is not defined (index):11
Uncaught ReferenceError: addRow is not defined (index):12
Uncaught ReferenceError: addRow is not defined (index):13
Uncaught ReferenceError: addRow is not defined (index):14
Uncaught ReferenceError: addRow is not defined (index):15
Uncaught ReferenceError: addRow is not defined (index):16
Uncaught ReferenceError: addRow is not defined (index):17
Uncaught ReferenceError: addRow is not defined (index):18
Uncaught ReferenceError: addRow is not defined (index):19
Uncaught ReferenceError: addRow is not defined (index):20
Uncaught ReferenceError: addRow is not defined (index):21
Uncaught ReferenceError: addRow is not defined (index):22
Uncaught ReferenceError: addRow is not defined (index):23
Uncaught ReferenceError: addRow is not defined (index):24
Uncaught ReferenceError: addRow is not defined (index):25
Uncaught ReferenceError: addRow is not defined (index):26
Uncaught ReferenceError: addRow is not defined (index):27
Uncaught ReferenceError: addRow is not defined (index):28
Uncaught ReferenceError: addRow is not defined (index):29
Uncaught ReferenceError: addRow is not defined (index):30
Uncaught ReferenceError: addRow is not defined (index):31
Uncaught ReferenceError: addRow is not defined (index):32
Uncaught ReferenceError: addRow is not defined (index):33
Uncaught ReferenceError: addRow is not defined (index):34
Uncaught ReferenceError: addRow is not defined (index):35
Uncaught ReferenceError: addRow is not defined (index):36
Uncaught ReferenceError: addRow is not defined (index):37
Uncaught ReferenceError: addRow is not defined (index):38
Uncaught ReferenceError: addRow is not defined (index):39
Uncaught ReferenceError: addRow is not defined (index):40
Uncaught ReferenceError: addRow is not defined (index):41
Uncaught ReferenceError: addRow is not defined (index):42
Uncaught ReferenceError: addRow is not defined (index):43
Uncaught ReferenceError: addRow is not defined (index):44
Uncaught ReferenceError: addRow is not defined (index):45
Uncaught ReferenceError: addRow is not defined (index):46
Uncaught ReferenceError: addRow is not defined (index):47
Uncaught ReferenceError: addRow is not defined (index):48
Uncaught ReferenceError: addRow is not defined (index):49
Uncaught ReferenceError: addRow is not defined (index):50
Uncaught ReferenceError: addRow is not defined (index):51
Uncaught ReferenceError: addRow is not defined (index):52
Uncaught ReferenceError: addRow is not defined (index):53
Uncaught ReferenceError: addRow is not defined (index):54
Uncaught ReferenceError: addRow is not defined (index):55
Uncaught ReferenceError: addRow is not defined (index):56
Uncaught ReferenceError: addRow is not defined (index):57
Uncaught ReferenceError: addRow is not defined (index):58
Uncaught ReferenceError: addRow is not defined (index):59
(anonymous function) (index):59
[/code]

@borhub
Copy link

borhub commented Sep 11, 2014

Hi @jasonsilver and @morganrallen , any luck chasing this down?

I am getting the same error on Android 4.0.4 APK on Huawei G300 (doesn't repro on my work's 4.0.4 Galaxy S2, but some of our users are getting it on their GS2s)

I am using angular and angular-ui-router. Might or might not be relevant.

D/CordovaActivity(16285): onMessage(onPageFinished,file:///android_asset/www/main.html)
D/CordovaActivity(16285): onMessage(onPageStarted,file:///#!/)
D/CordovaLog(16285): file:///#!/: Line 1 : Uncaught ReferenceError: start is not defined
E/Web Console(16285): Uncaught ReferenceError: start is not defined at file:///#!/:1
D/CordovaLog(16285): file:///#!/: Line 2 : Uncaught ReferenceError: addRow is not defined
E/Web Console(16285): Uncaught ReferenceError: addRow is not defined at file:///#!/:2
D/CordovaLog(16285): file:///#!/: Line 3 : Uncaught ReferenceError: addRow is not defined
E/Web Console(16285): Uncaught ReferenceError: addRow is not defined at file:///#!/:3
D/CordovaLog(16285): file:///#!/: Line 4 : Uncaught ReferenceError: addRow is not defined
E/Web Console(16285): Uncaught ReferenceError: addRow is not defined at file:///#!/:4

etc...

@michaelrkn
Copy link

michaelrkn commented Sep 24, 2014

this happens to me on an ember.js app compiled with phonegap. the app loads fine at first, but when the user signs out, i run location.reload(), and then i get these same errors.

@sithembiso
Copy link

sithembiso commented Oct 18, 2014

In case someone experiences this issue again, here is how I solved it on my app:

First, I was trying to get angularjs and phonegap to work on Android.

I still don't know why it happens, but it appears the android browser has issues with links starting with /.
For example, instead of /#!/something/here, try #!/something/here.
I'd be very interested to know the exact cause of the issue if anyone has an idea.
I hope it helps.

@borhub
Copy link

borhub commented Oct 27, 2014

Thanks for replying @sithembiso ! We'll look into this direction and report back for others.

@jasonsilver
Copy link

jasonsilver commented Nov 8, 2014

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.

@borhub
Copy link

borhub commented Nov 12, 2014

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 with file:/// 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 /.

@fmquaglia
Copy link

fmquaglia commented Dec 30, 2014

@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?

@Nrisimha
Copy link

Nrisimha commented Sep 10, 2018

@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!

@evandrocoan
Copy link

evandrocoan commented Apr 25, 2020

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment