Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Error on end, Unhandled Promise #187

Closed
scttcper opened this issue Aug 6, 2017 · 15 comments
Closed

Error on end, Unhandled Promise #187

scttcper opened this issue Aug 6, 2017 · 15 comments

Comments

@scttcper
Copy link

scttcper commented Aug 6, 2017

I'm using v1.2.0 to have chromless log into spotify and get the user auth token to manage a playlist (they have to be associated to a user not an application).

After chromeless.end I get an unhandeled promise rejection. I do briefly see chrome asking to save the password? Maybe not related.

Error: No such target id: undefined
    at IncomingMessage.<anonymous> (/Users/scoope7/xm-playlist-backend/node_modules/chrome-remote-interface/lib/external-request.js:16:26)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1045:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)

the code requires working username and password

import { Chromeless } from 'chromeless';

async function run() {
      const chromeless = new Chromeless();
      const screenshot = await chromeless
        .goto('https://accounts.spotify.com/en/authorize?client_id=bcfe5f4d02244abfb7e38a3052f02a76&response_type=code&redirect_uri=http:%2F%2Flocalhost:5000%2FupdatePlaylist&scope=playlist-modify-public&state=xmplaylist')
        .click('.btn,.btn-sm')
        .wait('#login-username')
        .type(config.spotifyUsername, 'input#login-username')
        .type(config.spotifyPassword, 'input#login-password')
        .click('.btn-green');
    
      await chromeless.end();
}

Edit: To be clear. Even with a catch on both awaits the error is not caught and throws a UnhandledPromiseRejectionWarning.

@scttcper scttcper changed the title Error on close, Unhandled Promise Error on end, Unhandled Promise Aug 6, 2017
@dattran92
Copy link

Same issue to me

@ShinyChang
Copy link

I have same issue.
Node 6.2.2
Chrome 60
OSX 10.12.6

@akashshinde
Copy link

Same issue, but in my case I am playing one video asset on browser. It looks like node process is getting terminated but not chrome browser with end() call.

@Jehanramadhan
Copy link

Jehanramadhan commented Aug 8, 2017

same issue with me.
Hopefully repaired ASAP.

@auser
Copy link

auser commented Aug 8, 2017

Seeing it here too

@joelgriffith
Copy link
Contributor

Curious if any of the above cases trigger a pageload of some kind. Right now that's a feature we're missing in chromeless is multi-page interactions

@mx781
Copy link

mx781 commented Aug 9, 2017

Seems to occur even without doing anything for me:

const { Chromeless } = require('chromeless')

async function run() {
  const chromeless = new Chromeless()
  await chromeless.end()
}
run().catch(console.error.bind(console))

Node v8.1.3
Chrome 60.0.3112.90
Ubuntu 16.04

janza added a commit to janza/chromeless that referenced this issue Aug 9, 2017
By making sure we're passing the right target to newly launched chrome
instance and later into the CDP.Close(...) call

Closes schickling#187
@kawikadkekahuna
Copy link

I'm still experiencing this issue in version 1.2 using the same codeblock that @mx781 had posted. Any updates?

@scttcper
Copy link
Author

A new version hasn't been cut yet with the fix.

@tsirolnik
Copy link

tsirolnik commented Aug 29, 2017

Still having the problem, with the given example -

const { Chromeless } = require('chromeless')

async function run() {
  const chromeless = new Chromeless()

  const screenshot = await chromeless
    .goto('https://www.google.com')
    .type('chromeless', 'input[name="q"]')
    .press(13)
    .wait('#resultStats')
    .screenshot()

  console.log(screenshot) // prints local file path or S3 url

  await chromeless.end()
}

run().catch(console.error.bind(console))

The error -

(node:5437) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: No such target id: undefined
(node:5437) 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.

@LeMoussel
Copy link

LeMoussel commented Aug 29, 2017

Idem, same error with the given example.

Node v8.3.0
chromeless v1.2.0
Chrome 60.0.3112.113 (Build officiel) (64 bits)
Windows 10

@koxu1996
Copy link

@adieuadieu Why don't you just release new version?

@adieuadieu
Copy link
Collaborator

I'm sorry for the delay. Just published v1.3.0 to NPM. Please do let us know if it resolves these issues!

@koxu1996
Copy link

It's working perfectly 👍

@LeMoussel
Copy link

Itou. Nickel 👍

webpolis pushed a commit to webpolis/yb-chromeless that referenced this issue Oct 5, 2017
By making sure we're passing the right target to newly launched chrome
instance and later into the CDP.Close(...) call

Closes schickling#187
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