vale icon indicating copy to clipboard operation
vale copied to clipboard

Chrome extension: Unable to connect

Open dvdksn opened this issue 1 year ago • 4 comments

Check for existing issues

  • [X] Completed

Environment

  • macOS 14.2.1 23C71 arm64
  • Homebrew
  • vale version 3.1.0

Describe the bug / provide steps to reproduce it

Tried to enable the Chrome extension but after installing, I get an error page with the following message.


Unable to connect The extension was unable to connect to the native messaging host. The following error was returned by either the host or the browser itself:

Native host has exited.


I tried installing the extension on both Chrome and Brave with the same result.

dvdksn avatar Feb 20 '24 10:02 dvdksn

Did vale host-install chrome complete successfully?

jdkato avatar Feb 20 '24 10:02 jdkato

Yes it did

dvdksn avatar Feb 20 '24 11:02 dvdksn

Is vale available on your $PATH? If so, could you check the log file at /Library/Application Support/vale/native/host.log?

jdkato avatar Feb 23 '24 08:02 jdkato

I have vale on PATH via /opt/homebrew/bin, but I don't have a /Library/Application Support/vale directory on my system.

dvdksn avatar Feb 23 '24 08:02 dvdksn

That path should be created with the host-install command.

The latest release includes more information in the command. Can you try to see if re-running it yields any information?

jdkato avatar Mar 01 '24 09:03 jdkato

vale host-install chrome on 3.2.0

$ vale host-install chrome
 SUCCESS  wrote '/Users/david/.config/vale/native/config.json'                                                                                                                                                              
 SUCCESS  fetched 'https://github.com/errata-ai/vale-native/releases/download/v0.3.1/vale-native_Darwin_arm64.zip'                                                                                                          
 SUCCESS  installed '/Users/david/Library/Application Support/Google/Chrome/NativeMessagingHosts/sh.vale.native.json'                                                                                                       
installing host [3/3]

So it creates these under my home directory /Users/david. I still see the same issue with the extension in Chrome. I found the host.log for vale under my home dir as well, which also suggests there's a path issue.

$ cat /Users/david/Library/Application\ Support/vale/native/host.log | jq .
{
  "time": "2024-03-01T12:09:02.635033+01:00",
  "level": "INFO",
  "msg": "open /Users/david/Library/Application Support/vale/native/config.json: no such file or directory"
}

/Users/david/Library/Application Support/vale/native/config.json doesn't exist.

dvdksn avatar Mar 01 '24 11:03 dvdksn

I think I understand the issue now.

Presumably, you have an environment variable that is setting XDG_CONFIG_HOME to ~/.config (overriding the default value).

Vale is respecting this when it writes the config file. When Chrome starts the host, however, the CLI environment is not loaded (which means the default value is being used).

I'll have to think about how to fix this.

jdkato avatar Mar 01 '24 12:03 jdkato

yes, I have set XDG_CONFIG_HOME

dvdksn avatar Mar 01 '24 12:03 dvdksn

This should be fixed in the latest release.

jdkato avatar Mar 05 '24 19:03 jdkato