New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 696198 link

Starred by 8 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug

Blocked on:
issue 699392



Sign in to add a comment

http://localhost:9222/json/new returns "Could not create new page" when --headless is used

Reported by cyrus....@gmail.com, Feb 25 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Steps to reproduce the problem:
1. google-chrome-unstable --remote-debugging-port=9222 --headless
2. curl http://localhost:9222/json/new

What is the expected behavior?
A new tab/target is created and returned via the HTTP endpoint. For example:

{
   "description": "",
   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/754adcd6-73fe-453b-bca6-459b881d4599",
   "id": "754adcd6-73fe-453b-bca6-459b881d4599",
   "title": "",
   "type": "page",
   "url": "about:blank",
   "webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/754adcd6-73fe-453b-bca6-459b881d4599"
}

What went wrong?
The new tab/target is not created; the HTTP endpoint replies with error code 500 and "Could not create new page".

Did this work before? N/A 

Chrome version: 58.0.3018.3  Channel: stable
OS Version: Debian GNU/Linux 8
Flash Version: n.a.
 

Comment 1 by cyrus....@gmail.com, Feb 25 2017

It works as expected without --headless.
Labels: Needs-Triage-M58
Cc: jmukthavaram@chromium.org
Labels: -Needs-Triage-M58 M-58
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Linux ubuntu 14.04 using chrome latest Canary-58.0.3024.0 as per the steps in comment#0.
This in regression issue broken in beta-57.0.2987.54 & Working as expected in earlier builds of beta .
Unable to provide bisect as we need to run step 1 through command prompt to proceed.
Hence marking this issue as 'Untriaged'.

Note: Issue specific to Linux OS.
Thank you.



Owner: skyos...@chromium.org
Status: Assigned (was: Untriaged)
Cc: skyos...@chromium.org
Labels: Proj-Headless
Owner: ----
Status: Available (was: Assigned)
I don't think we support that http endpoint yet in headless mode.

In the meantime, you could connect to the browser's DevTools target and use this command to open a page:

https://chromedevtools.github.io/debugger-protocol-viewer/tot/Target/#method-createTarget

Comment 6 by cyrus....@gmail.com, Feb 27 2017

Thanks for your reply.

Yeah, I'm aware of that, but I was curious since /json/list works fine. Actually, it seems that there are problems with /json/close and /json/activate too, just noticed that...

Can I assume that this issue will be closed once the HTTP endpoint will be fully supported in headless mode too?
I'm somewhat wondering if it makes sense to support the http endpoint if the protocol already has equivalent functionality. Of course this is open for debate.

Comment 8 by cyrus....@gmail.com, Feb 27 2017

You need to have at least one open target to open another and it's allowed to close all the targets; in this case it's impossible to open a new one without restarting Chrome.
There's a special browser DevTools target (/devtools/browser) which will always be there even if no tabs are open.
Oh cool, I didn't know about that... I noticed some weird behaviors though:

- Target.getTargets never works via /devtools/browser (headless mode or not) [https://bugs.chromium.org/p/chromium/issues/detail?id=697048];

- Target.createTarget via /devtools/browser only works in headless mode.

Now these are probably bugs/incomplete features but it would be nice IMO that /devtools/browser worked consistently regardless the headless mode.
It's unclear, and a breaking change for production implementations based on headless, as to why the /json endpoint has suddenly stopped working (deprecated?) on headless.

Back in June 2016, this issue (/json/new not working in headless) cropped up on the headless-dev group:
https://groups.google.com/a/chromium.org/d/topic/headless-dev/I16EisDwza4/discussion

In July 2016, new DevTools commands were added to support tab/context management on headless:
https://groups.google.com/a/chromium.org/d/msg/headless-dev/I16EisDwza4/npjP4AN_CAAJ
https://codereview.chromium.org/2119063002/

It was working fine, until recently, when the /json endpoint stopped working in headless, as reported in this issue as well as on the chrome-remote-interface github page:
https://github.com/cyrus-and/chrome-remote-interface/issues/83
Different browser implementations seem to be supporting different methods, rather than a single or at-least compatible API:

* [chrome.exe] supports /json endpoint but not /devtools/browser

* [chrome.exe --headless] supports /devtools/browser endpoint (and /json on Windows but not on Linux?!)

* [headless_shell] supports /devtools/browser endpoint but not /json

We'll appreciate some clarity, for coherent development of solutions based on headless. It's also important for a consistent RemoteDebug spec.
Correction in my comment (#12) above:

* [headless_shell] doesn't support /devtools/browser endpoint (Error: 'Target.createTarget' wasn't found), and doesn't support /json
Owner: sushkov@chromium.org
Blockedon: 699392
Components: Internals>Headless
Status: Fixed (was: Available)
Since the blocker is resolved, I believe json/new should be working in M61, if not earlier builds, too.

Regarding #12/13: the browser endpoint should exist in headless. The Target domain doesn't work fully on this endpoint and doesn't exist in non-headless mode yet,  bug 697048  tracks this.

Sign in to add a comment