Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to attach to browser on macos #697

Closed
jeiea opened this issue Jul 10, 2020 · 15 comments
Closed

Unable to attach to browser on macos #697

jeiea opened this issue Jul 10, 2020 · 15 comments
Assignees

Comments

@jeiea
Copy link

jeiea commented Jul 10, 2020

  • VS Code Version: 1.47.0
  • Log file (set "trace": true in launch config): vscode-debugadapter-0.json.gz (I know it's broken, but I tried twice.)
  • vscode-chrome-debug version: 4.12.9

What I did

  1. Save launch.json with the following
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}",
      "userDataDir": "${workspaceFolder}/.vscode/chrome",
      "trace": true
    }
  ]
}
  1. Press F5

What I expected

Normal launch

What I got

image

Additional context

4.12.8 doesn't have this problem. It may be a regression.

@markmcdowell
Copy link

Yep same here, had to downgrade.

@roblourens
Copy link
Member

roblourens commented Jul 10, 2020

You can also set "debug.javascript.usePreview": false to work around this

cc @connor4312

@roblourens roblourens assigned roblourens and unassigned roblourens Jul 10, 2020
@connor4312
Copy link
Member

Thanks for the issue! I notice you're using a static userDataDir.

Did you already have an instance of Chrome opened from the user data directory? In that case we will be unable to attach to it.

@niemyjski
Copy link

I'm seeing this as well.

@connor4312
Copy link
Member

Please collect a trace log using these instructions:

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to connor@xbox.com

@ghost
Copy link

ghost commented Jul 24, 2020

Here is the trace log for the error that I got. I hope it can help solve this issue. It might be that I'm loading in some weird cdns in my HTML template. Thanks to @roblourens for the workaround.
vscode-chrome-debug.txt

@arnotes
Copy link

arnotes commented Jul 28, 2020

this also happens on windows btw
image
image

@connor4312
Copy link
Member

@arnotes can you grab a trace log using these instructions? https://github.com/microsoft/vscode-chrome-debug/issues/1023#issuecomment-658423848

@callbiruk
Copy link

@jeiea Try changing the type value from chrome to pwa-chrome

...
// "type": "chrome",
"type": "pwa-chrome",
...

Even though It doesn't open with your chrome default profile, it is something.

@AkashManiar
Copy link

AkashManiar commented Aug 8, 2020

It had happened with me too, as shown by @arnotes, here is my log record

@connor4312
Copy link
Member

@AkashManiar please include the file directly. That tool is just browser-side, linking to it doesn't show me what you opened with it 🙂

@roblourens roblourens transferred this issue from microsoft/vscode-chrome-debug Aug 12, 2020
@connor4312
Copy link
Member

I'm calling this 'fixed' with microsoft/vscode#103083 (comment), since that's by far the most common case where this issue happens -- aside from just an attach config where the url or filter doesn't match. If you continue to run into this problem:

  1. Use the nightly build https://github.com/microsoft/vscode-js-debug#nightly-extension
  2. If your issue continues to happen there, file an issue using this template: https://github.com/microsoft/vscode-js-debug/issues/new/choose

@jeiea
Copy link
Author

jeiea commented Aug 14, 2020

Then same userdatadir won't be allowed? It's so sad I can't do the thing worked well with the previous version...

@connor4312
Copy link
Member

It is allow if and only if you choose to launch chrome with a port. For security reasons, by default the new debugging launches Chrome with a remote debugging pipe via its stdio. This means that when js-debug launches the browser, it must be in control of the browser arguments, but if a browser is already opened in the user data dir Chrome will ignore the arguments and 'merge' with the previous launch.

@csutorasr
Copy link

csutorasr commented Dec 17, 2020

I have an open chrome on the Mac Os docker. I clicked on it and pressed cmd+Q.

Afterwards vscode could reopen Chrome.

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

No branches or pull requests

9 participants