Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

navalia.run errors with a 404 #72

Open
michaelwills opened this issue Feb 14, 2018 · 9 comments
Open

navalia.run errors with a 404 #72

michaelwills opened this issue Feb 14, 2018 · 9 comments

Comments

@michaelwills
Copy link

First, awesome project. I have seen notes about this project is or will be deprecated. I do hope rumors of its demise will be proven false. :)

The Chrome instance is easy enough to use however the navalia usage seems to have a problem. I haven't dug into code yet though.

This example fails:

process.env.DEBUG = "navalia";

import { Navalia } from "navalia";

const navalia: Navalia = new Navalia();

(async () => {
  await navalia.run(async chrome => chrome.goto("http://joelgriffith.net"));
})();

Output:

Wed, 14 Feb 2018 22:01:20 GMT navalia starting, using up to 1 instances
Wed, 14 Feb 2018 22:01:20 GMT navalia instances are available and starting
(node:22949) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: unexpected server response (404)
(node:22949) [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.
@michaelwills michaelwills changed the title .run errors with a 404 navalia.run errors with a 404 Feb 14, 2018
@joelgriffith
Copy link
Owner

Alrighty, this should be fixed in 1.3.0 which I just published 🎉

@michaelwills
Copy link
Author

It's certainly an improvement! No more 404. The updated test code and error is below:

process.env.DEBUG = "navalia";

import { Navalia } from "navalia";

const navalia: Navalia = new Navalia();

(async () => {
  await navalia.run(
    async chrome =>
      await chrome.goto("http://example.com", {
        timeout: 10000,
        coverage: false,
        onload: true
      })
  );
})();

States there is a timeout now which

2018-02-15T17:35:16.143Z navalia starting, using up to 1 instances
2018-02-15T17:35:16.147Z navalia instances are available and starting
2018-02-15T17:35:18.127Z navalia instance 63154 is starting work
(node:50398) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Goto failed to load in the timeout specified
(node:50398) [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.

@michaelwills
Copy link
Author

@joelgriffith running the tests does have a failure:

Test Suites: 1 failed, 2 passed, 3 total
Tests:       1 failed, 39 passed, 40 total
Snapshots:   8 passed, 8 total

Specifically:

 FAIL  integration/api.test.ts (74.361s)
  ● Chrome › #evaluate › should allow variables to be passed in

    Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.

I'll see if I can dig in a bit later. Thanks much!

@michaelwills
Copy link
Author

michaelwills commented Feb 15, 2018

[edit] Quick test with navalia graphql works adding the following to Chrome.ts

  Promise.all([
    cdp.Page.enable(),
    cdp.Network.enable()
  ])
    .then(() => {
      return cdp.Page.navigate({url})
    })
    .catch(err => {
      reject(`Failed: ${err} ${url} ${typeof url}`)
    })

query:

{
  goto(url: "http://example.com") {
    url
  }
}

result:
{
  "data": {
    "goto": {
      "url": "http://example.com/"
    }
  },
  "extensions": {
    "time": 2377
  }
}

Test Suites: 3 passed, 3 total
Tests:       40 passed, 40 total
Snapshots:   8 passed, 8 total
Time:        59.034s, estimated 75s

And all tests pass. So perhaps the Chrome version requires a different approach?

@js-writer
Copy link

@michaelwills I have the same error. I'm using chrome 64.0.3282.186 and browser doesn't open.

When I add flag: const chrome = new Chrome({ flags: { headless: false } });
New browser instance open but in it goes to about:blank…

@joelgriffith
Copy link
Owner

Yeah, there's been some breaking changes in the Chromes remote protocol in recent versions. Unfortunately I'm at least a few days out from revisiting this project to bring it up to date, so I'd love some help:

  • Make sure the most recent version of Chrome is installed
  • Use the tests to ensure it's running properly

Otherwise it's going take me a few to get it :/

@michaelwills
Copy link
Author

@sefel When I run it visibly, it's actually Google Chrome Canary that launches as opposed to Google Chrome. I'll try to do some more tests.

@js-writer
Copy link

@michaelwills Yes I'm sure it was at the most recent version of Chrome (Google Chrome and also on Canary) and I tested it on all systems (Windows/OSX/Ubuntu). So I think it is problem with new Chrome.

@MrJadaml
Copy link

MrJadaml commented Mar 7, 2018

I am also running into that Timer error. Here is my output.

Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.                                        
                                                                                                                                                  
      at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:523:19)
      at ontimeout (timers.js:475:11)
      at tryOnTimeout (timers.js:310:5)
      at Timer.listOnTimeout (timers.js:270:5)

Running on linux - no Canary as it is not available for linux :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants