johnste / finicky

A macOS app for customizing which browser to start
MIT License
3.67k stars 136 forks source link

Finicky not working with React's debugger-ui #277

Open nurse-the-code opened 2 years ago

nurse-the-code commented 2 years ago

Describe the bug When developing React Native apps, the debugger is not correctly loading in the browser

Your configuration Machine: MacBook Air (M1, 2020) OS: macOS Monterey version 12.4 Xcode: Version 13.4.1 (13F100) Chrome: Version 103.0.5060.114 (Official Build) (arm64)

My finicky.js file:

// ~/.finicky.js

module.exports = {
    defaultBrowser: "Safari",
    rewrite: [
        {
            // Redirect all urls to use https
            match: ({ url }) => url.protocol === "http",
            url: { protocol: "https" }
        }
    ],
    handlers: [
        {
            // Open google.com and *.google.com urls in Google Chrome
            match: ["localhost:*/debugger-ui"],
            browser: {
                name: "Google Chrome",
                profile: "my-profile"
            }
        },
        {
            match: ({ url }) => url.host === "localhost",
            browser: "Firefox",
        },
        {
            // Open google.com and *.google.com urls in Google Chrome
            match: [
                "google.com/*", // match google.com urls
                "*.google.com/*", // match google.com subdomains
            ],
            browser: {
                name: "Google Chrome",
                profile: "my-profile"
            }
        }
    ]
};

Your configuration Please add a link to or paste the relevant parts of your configuration here

To Reproduce Steps to reproduce the behavior:

  1. Open a React Native app you are developing on your iPhone (this step assumes some familiarity with React Native development).
  2. Shake your device to access the development menu.
  3. Click on "Debug".
  4. Google Chrome should automatically open (or at least a new tab will open). Chrome will attempt to navigate debugger-ui (for me this was https://localhost:8081/debugger-ui).
  5. If default browser (set is System Preferences) was set to Finicky with the above settings, the Chrome prints an error message saying the following:
    This site can’t provide a secure connection
    localhost sent an invalid response.
    ERR_SSL_PROTOCOL_ERROR
  6. If default browser (set is System Preferences) was set to Chrome, the debugger opens without issue.