finicky: Configuration parsing fails inconsistently

I’m migrating my old config to the new format but am seeing a notification about an error parsing config. In order to try to isolate the problem, I copied the config from the “Advanced usage, settings” section of the README in order to start adding my old configuration bit by bit.

As expected, when I copy over everything intact to .finicky.js I see that a notification that the file was loaded, but if I save again (with no changes to the stock config) it appears to fail maybe half the time. Closing and reopening Finicky does not change this behavior.

This was seen on RC0 (in About: Version 2.0-RC0 (1)).

In RC1 which appears to have been uploaded as I was writing out this issue, I get some slightly better output, though it is still failing around half of the time:

2019-05-21 13:06:58 - Error parsing config: "TypeError: undefined is not an object (evaluating 'object[key]')"

Again, this is with the stock config:

module.exports = {
  defaultBrowser: "Google Chrome",
  options: {
    // Hide the finicky icon from the top bar
    hideIcon: true
  },
  handlers: [
    {
      // Open any link clicked in Slack in Safari
      match: ({ sourceBundleIdentifier }) =>
        sourceBundleIdentifier === "com.tinyspeck.chatlyio",
      browser: "Safari"
    },
    {
      match: ["http://zombo.com"],
      browser: {
        name: "Google Chrome Canary",
        // Force opening the link in the background
        openInBackground: true
      }
    }
  ]
};

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Note that I managed to make it work - and it confirms my hypothesis of a difference in external libraries version:

  1. I downloaded a recent webkit version from https://webkit.org/build-archives/ (I took the latest for Sierra - build 239857)
  2. I updated the application to use this version instead of the system one (Note: I embedded the framework in the app itself but it was just because I was fiddling with it): install_name_tool -change /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore /Users/llange/Applications/Finicky.app/Contents/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore ~/Applications/Finicky.app/Contents/MacOS/Finicky (I believe I could use there a relative marker for the path - did not try it yet)
  3. Then I opened the application (on command line), which was quite ok but 2 warnings (due to the recent webkit I believe):
2019-07-03 14:08:52.675 Finicky[78866:955766] NSSoftLinking - The DataDetectors framework's library couldn't be loaded from /System/Library/PrivateFrameworks/DataDetectors.framework/Versions/A/DataDetectors.
2019-07-03 14:08:52.675 Finicky[78866:955766] NSSoftLinking - The function 'DDMenuItemGetActionUTI' can't be found in the DataDetectors framework.

And I was able to open a link n the console:

2019-07-03 14:08:55 - Would open bundleIdorg.mozilla.firefox-perso  URL: https://example.com

So I believe it’s due to my aging version of macos, itself having an old version of webkit.

I see multiple paths here

  • Ignore old macos versions 😦
  • Embed webkit JavaScriptCore.framework (additional 21M, need to know which version, depends on the OS version, …)
  • Find the functions that were modified and detect / find a workaround
  • others ?

If some other have this issue (mainly @stackptr ), could they confirm their macos version / JavaScriptCore version to see if there is a pattern here ?

It logs the following:

2019-07-03 13:07:47 - {
  "defaultBrowser": {
    "name": "org.mozilla.firefox-perso",
    "appType": "bundleId",
    "openInBackground": false
  }
}

Any click or Finicky Console test result in the same error:

2019-07-03 13:08:02 - Configuration: TypeError: undefined is not an object

2019-07-03 13:08:02 - Configuration: SyntaxError: Unexpected token '...'. Expected a property name.

If I log on stdout, I have a little more info but still not usable:

Start listening to file changes
Cancel fileDescriptor
Reload config. showSuccess: false
Created new context
2019-07-03 13:55:29.340 Finicky[67972:868412] {
  "defaultBrowser": {
    "name": "org.mozilla.firefox-perso",
    "appType": "bundleId",
    "openInBackground": false
  }
}
Valid config: true
Error parsing config: "SyntaxError: Unexpected token '...'. Expected a property name."
Stack: undefined:73:undefined
Error parsing config: "TypeError: undefined is not an object"
Stack: undefined:undefined:undefined

(I don’t know what the 73 is about, I have no line 73 nor column 73 in the file)

Additional information : I install the application with HomeBrew, in my local user “Applications” folder (~/Applications).

Here is the libraries and their versions as resolved on my system:

Šnek:~ llange$ otool -L ~/Applications/Finicky.app/Contents/MacOS/Finicky
/Users/llange/Applications/Finicky.app/Contents/MacOS/Finicky:
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/JavaScriptCore (compatibility version 1.0.0, current version 607.1.40)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1570.15.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1671.40.118)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1570.15.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 944.3.0)
	@rpath/libswiftAppKit.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftCoreData.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftCoreFoundation.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftCoreImage.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftIOKit.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftMetal.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftQuartzCore.dylib (compatibility version 1.0.0, current version 1001.0.82)
	@rpath/libswiftXPC.dylib (compatibility version 1.0.0, current version 1001.0.82)

Thanks you!

Your updated configuration works just fine for me which feels peculiar. I’ll try it some more to see if I can figure out what’s going on.

I want to note your config won’t fully work. finicky.matchDomains() is a function that will only match against domains/hostnames and your array workUrls contain full url regular expressions. You can use the workUrls array directly instead:

// Freckle-related links in work browser
const workUrlsHandler = {
  match: workUrls,
  browser: workBrowser
};