Skip to content

Debug function no longer working with latest version of Chrome #296

Closed

Description

@Jell

I believe the issue is that the devtoolsFrontendUrl has changed and is now a fully qualified URL of this shape:

https://chrome-devtools-frontend.appspot.com/serve_rev/@0f351bbd2617e0f775543271f34b7d241f8ebcdc/inspector.html?ws=127.0.0.1:59784/devtools/page/1BEAF3B70D21B8A922DB33142416038C

Which leads the debug_url to be incorrect:

http://127.0.0.1:59784https://chrome-devtools-frontend.appspot.com/serve_rev/@0f351bbd2617e0f775543271f34b7d241f8ebcdc/inspector.html?ws=127.0.0.1:59784/devtools/page/33A55C714077D24AFB103C88BE15D12E

I solved it on my end by just returning the devtoolsFrontendUrl as-is:

def debug_url
  response = JSON.parse(Net::HTTP.get(URI(build_remote_debug_url(path: "/json"))))
  devtools_frontend_path = response[0]&.[]("devtoolsFrontendUrl")
  raise "Could not generate debug url for remote debugging session" unless devtools_frontend_path

  devtools_frontend_path
end

Activity

  1. Jell commented on Apr 9, 2025

    @Jell
    ContributorAuthor

    I made a PR with a regression spec and a fix for the above: #297

  2. Jell commented on Apr 10, 2025

    @Jell
    ContributorAuthor

    update: I've revised my fix so that it works with both the new and the old version of chrome (fully qualified URL and relative path), to make it a non-breaking change.

  3. alessandro-fazzi commented on May 5, 2025

    @alessandro-fazzi

    @Jell have you deepened what https://chrome-devtools-frontend.appspot.com/ is? And do you know what happens when running a test w/o internet connection?

    TIA

  4. Jell commented on May 5, 2025

    @Jell
    ContributorAuthor

    @Jell have you deepened what https://chrome-devtools-frontend.appspot.com/ is? And do you know what happens when running a test w/o internet connection?

    TIA

    this is just what the chrome instance returns as the URL for the debugger, it is not available offline. If you visit that URL you will get a rationale about why the google team migrated to this approach:

    DevTools Frontend serves static assets at chrome-devtools-frontend.appspot.com for three primary reasons:
    
    1. Remote debugging. A user [remote-debugging](https://developer.chrome.com/docs/devtools/remote-debugging/) Chrome on Android needs to use a version of DevTools that is compatible with the Chrome version they are debugging. (Canary DevTools isn’t necessarily compatible with Stable Chrome, and vice versa). In this situation, all the files for the DevTools UI are loaded from GAE.
    2. DevTools remote modules. Some components of DevTools are considered too large to ship by default (and increase Chrome’s binary size). These “remote modules” (such as device images, the 3rd party lookup database) are fetched from this service on demand.
    3. Localisation files. Most localisation files are excluded from DevTools and only loaded on demand.
    

    basically they are no longer shipping those devtools hooks as part of chrome, and it seems they decided that the simplest approach was to make the debugger a static webpage instead.

  5. alessandro-fazzi commented on May 5, 2025

    @alessandro-fazzi

    I'm well aware you're not in the Chrome team, so thank you, even more, for your kind reply and research.

    While I'm still quite ignorant on this matter, it sounds to me like as a consequence we could be no more able to debug an application while offline or behind something-enterprisey-blocking-our-connection-to-that-url. Is it just my fear or does it make any sense?

  6. Jell commented on May 5, 2025

    @Jell
    ContributorAuthor

    While I'm still quite ignorant on this matter, it sounds to me like as a consequence we could be no more able to debug an application while offline or behind something-enterprisey-blocking-our-connection-to-that-url. Is it just my fear or does it make any sense?

    you are correct, making it work offline or behind a strict firewall would now require some workaround (like caching the page or adding allow rules to the something-enterprisey-blocking-our-connection-to-that-url).

    It's a breaking change from the chrome dev team that comes with some trade-offs, some things become easier other become more tricky. BUT! The debug function only really make sense when doing some "live" debugging, so will most likely run on your local dev machine, and I think it's a reasonable expectation nowadays that all dev machines have internet connection. So if you want my 2 cents I think it's a reasonable approach :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions