{"action":"created","issue":{"url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/359","repository_url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface","labels_url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/359/labels{/name}","comments_url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/359/comments","events_url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/359/events","html_url":"https://github.com/cyrus-and/chrome-remote-interface/issues/359","id":362147236,"node_id":"MDU6SXNzdWUzNjIxNDcyMzY=","number":359,"title":"Debugger.paused  hangs (unable to pause the debugger from node.js)","user":{"login":"oszyvik","id":18242201,"node_id":"MDQ6VXNlcjE4MjQyMjAx","avatar_url":"https://avatars3.githubusercontent.com/u/18242201?v=4","gravatar_id":"","url":"https://api.github.com/users/oszyvik","html_url":"https://github.com/oszyvik","followers_url":"https://api.github.com/users/oszyvik/followers","following_url":"https://api.github.com/users/oszyvik/following{/other_user}","gists_url":"https://api.github.com/users/oszyvik/gists{/gist_id}","starred_url":"https://api.github.com/users/oszyvik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oszyvik/subscriptions","organizations_url":"https://api.github.com/users/oszyvik/orgs","repos_url":"https://api.github.com/users/oszyvik/repos","events_url":"https://api.github.com/users/oszyvik/events{/privacy}","received_events_url":"https://api.github.com/users/oszyvik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-20T11:38:50Z","updated_at":"2018-09-25T15:34:31Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nWe are facing an issue for a while.\r\n\r\nThere is a node.js server running, and we have a client connected to it. The client has a simple TextBox, where you can write javascript code. Once the desired code is written, you can send it to the node.js server.\r\n\r\nIn Node.js the received javascript code will be written in a .js file, and after that it will be started in a childProcess (execFile function).\r\n\r\nWe want to use chrome remote interface to be able to pause the execution of the js file, edit it and after resume the execution. This is important to do it from code (not with chrome://inspect) because when pausing the execution with the debugger we also have to pause some other things.\r\n\r\nOur problem is that await Debugger.paused() is hangs, the debugger never gets paused, therefore calling await Debugger.resume() we are getting the error: Can only perform operation while paused.\r\n\r\nHere is a code snippet about how we are connecting the debugger:\r\n```js\r\nconst CDP = require('chrome-remote-interface');\r\n\r\nexports.RemoteDebuggerInterface = class {\r\n    constructor(port) {\r\n        this.port = port;\r\n        this.connected = false;\r\n    }\r\n\r\n    async connect(isScriptPausedByDefault = true) {\r\n        let debuggerTargets = await this.getDebuggerTargets();\r\n\r\n        if (debuggerTargets && debuggerTargets.length > 0) {\r\n\r\n            let debuggerTarget = debuggerTargets[0];\r\n\r\n            this.debuggerClient = await new CDP({\r\n                port: this.port,\r\n                target: debuggerTarget\r\n            });\r\n\r\n            if (this.debuggerClient) {\r\n                console.log('Connected to remote debugger on: ' + debuggerTarget['webSocketDebuggerUrl']);\r\n                console.log('DevTools can be reached on: ' + debuggerTarget['devtoolsFrontendUrl']);\r\n            }\r\n            this.connected = true;\r\n\r\n            this.subscribeToClientEvent(this.debuggerClient, 'Runtime.executionContextDestroyed').then((message) => {\r\n                console.log('Execution context destroyed :' + message);\r\n            });\r\n\r\n            if (isScriptPausedByDefault) {\r\n                await this.debuggerClient.Runtime.runIfWaitingForDebugger();\r\n            }\r\n            this.subscribeToClientEvent(this.debuggerClient, 'Debugger.scriptParsed').then((message) => {\r\n                console.log(message);\r\n            });\r\n\r\n            let id = await this.debuggerClient.Debugger.enable();\r\n            console.log('Debugger enabled with unique id: ' + id);\r\n\r\n          //to not copy a lot of code, we tried here to pause the debugger\r\n          await this.debuggerClient.Debugger.paused();\r\n          //by calling resume, we are getting the error: Can only perform operation while paused.\r\n          await this.debuggerClient.Debugger.resume();\r\n\r\n\r\n            return this.debuggerClient;\r\n        }\r\n        else {\r\n            throw Error('error at connecting to the remote debugger');\r\n        }\r\n    }\r\n```\r\n\r\nAlso, we are not able to open devtools by the given link (devtoolsFrontendUrl). The only way to open is using NIM extension for Chrome. BUT if the devtools is opened in chrome, then we get an error in node.js:\r\nTypeError: Parameter \"url\" must be a string, not undefined\r\nmessage:\"Parameter \"url\" must be a string, not undefined\"\r\nstack:\"TypeError: Parameter \"url\" must be a string, not undefined\r\nat Url.parse (url.js:103:11)\r\nat urlParse (url.js:97:13)\r\nat Chrome._start (...\\node_modules\\chrome-remote-interface\\lib\\chrome.js:130:31)\r\n\r\nI know I have a lot of questions, but I would like to start a discussion about this topic, because this is very important for us.\r\n\r\n| Component | Version\r\n|-|-\r\n| Operating system\t  \t \t| Win8 64 bit\r\n| Node.js\t\t\t\t\t| v8.11.3\r\n| Chrome/Chromium/...\t\t| 69.0.3497.100\r\n| chrome-remote-interface\t| 0.26.1\r\n\r\nIs Chrome running in a container? NO\r\n"},"comment":{"url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/comments/424392460","html_url":"https://github.com/cyrus-and/chrome-remote-interface/issues/359#issuecomment-424392460","issue_url":"https://api.github.com/repos/cyrus-and/chrome-remote-interface/issues/359","id":424392460,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDM5MjQ2MA==","user":{"login":"cyrus-and","id":1660263,"node_id":"MDQ6VXNlcjE2NjAyNjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1660263?v=4","gravatar_id":"","url":"https://api.github.com/users/cyrus-and","html_url":"https://github.com/cyrus-and","followers_url":"https://api.github.com/users/cyrus-and/followers","following_url":"https://api.github.com/users/cyrus-and/following{/other_user}","gists_url":"https://api.github.com/users/cyrus-and/gists{/gist_id}","starred_url":"https://api.github.com/users/cyrus-and/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyrus-and/subscriptions","organizations_url":"https://api.github.com/users/cyrus-and/orgs","repos_url":"https://api.github.com/users/cyrus-and/repos","events_url":"https://api.github.com/users/cyrus-and/events{/privacy}","received_events_url":"https://api.github.com/users/cyrus-and/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T15:34:31Z","updated_at":"2018-09-25T15:34:31Z","author_association":"OWNER","body":"Does the above make sense?"}}
{"actor":{"display_login":"cyrus-and"}}