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

Improve Error Handling ("CLI Failed to run bridge.") #1296

Open
tacerus opened this issue Apr 19, 2021 · 1 comment
Open

Improve Error Handling ("CLI Failed to run bridge.") #1296

tacerus opened this issue Apr 19, 2021 · 1 comment
Labels
S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements.

Comments

@tacerus
Copy link
Contributor

tacerus commented Apr 19, 2021

Describe the bug
Upon migrating an instance of matrix-appservice-irc by importing the database and copying the configuration files over to a new system I was faced with generic errors, which were only resolvable upon analyzing the startup process with strace. I deem this not user friendly, as the errors were very easy to resolve after finding out what they are.

To Reproduce
Steps to reproduce the behavior:

  1. Install the program using npm, either with or wihout a cloned git repository at hand
  2. Set up a PostgreSQL database filled with data from a previous matrix-appservice-irc install
  3. Make sure the npm packages color-name and color-convert are NOT installed
  4. Make sure provisioning is configured in the config.yaml, but do NOT provide a provisioning.rules.yaml file in the installation directory.
  5. Observe the program present you with a generic "Failed to run bridge." error message.

Expected behavior

  1. The program should tell the user which npm packages are missing.
  2. The program should tell the user which configuration files are missing.

Observed behavior

The program prints the following console output:

Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:IrcBridge Started metrics on http://127.0.0.1:9976
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:IrcBridge Using PgDataStore for Datastore
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:CryptoStore Private key loaded from /opt/matrix/appserviceirc/passkey.pem - IRC password encryption enabled.
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore Starting postgres database engine
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore Database schema is at version v5
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:IrcServer Reconfiguring irc.liberta.casa
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!kGldNYWbgjhCfxkkJI:liberta.casa, addr=irc.liberta.casa, chan=#mods, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!kluNNKMKtGSnRiVdpf:liberta.casa, addr=irc.liberta.casa, chan=#dev, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!owFmWWcNHVQbjIITNp:liberta.casa, addr=irc.liberta.casa, chan=#help, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!CxaPdOZSAoPLiAQzcU:liberta.casa, addr=irc.liberta.casa, chan=#annie, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!YpZhKgnqANeHgWkmoI:liberta.casa, addr=irc.liberta.casa, chan=#praxis, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 INFO:PgDatastore storeRoom (id=!HBbrMSEerejblGhsSV:aria-net.org, addr=irc.liberta.casa, chan=#ita, origin=config, type=channel)
Apr 19 19:50:29 theia node[23330]: Apr-19 19:50:29.944 INFO room-link-validator Detected rule config change...
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 ERROR:CLI Failed to run bridge.
Apr 19 19:50:29 theia node[23330]: 2021-04-19 19:50:29 ERROR:CLI undefined

The program prints the following into the configured error logfile:
ERROR:CLI Failed to run bridge.

The program prints the following into the configured debug logfile:

INFO:IrcBridge Started metrics on http://127.0.0.1:9976
INFO:IrcBridge Using PgDataStore for Datastore
INFO:CryptoStore Private key loaded from /opt/matrix/appserviceirc/passkey.pem - IRC password encryption enabled.
INFO:PgDatastore Starting postgres database engine
INFO:PgDatastore Database schema is at version v5
INFO:IrcServer Reconfiguring irc.liberta.casa
INFO:PgDatastore storeRoom (id=!kGldNYWbgjhCfxkkJI:liberta.casa, addr=irc.liberta.casa, chan=#mods, origin=config, type=channel)
INFO:PgDatastore storeRoom (id=!kluNNKMKtGSnRiVdpf:liberta.casa, addr=irc.liberta.casa, chan=#dev, origin=config, type=channel)
INFO:PgDatastore storeRoom (id=!owFmWWcNHVQbjIITNp:liberta.casa, addr=irc.liberta.casa, chan=#help, origin=config, type=channel)
INFO:PgDatastore storeRoom (id=!CxaPdOZSAoPLiAQzcU:liberta.casa, addr=irc.liberta.casa, chan=#annie, origin=config, type=channel)
INFO:PgDatastore storeRoom (id=!YpZhKgnqANeHgWkmoI:liberta.casa, addr=irc.liberta.casa, chan=#praxis, origin=config, type=channel)
INFO:PgDatastore storeRoom (id=!HBbrMSEerejblGhsSV:aria-net.org, addr=irc.liberta.casa, chan=#ita, origin=config, type=channel)
ERROR:CLI Failed to run bridge.

Manual troubleshooting using strace

openat(AT_FDCWD, "./provisioning.rules.yaml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(17, "2021-04-19 20:01:24 ERROR:CLI Fa"..., 522021-04-19 20:01:24 ERROR:CLI Failed to run bridge.

Aha!

@jaller94 jaller94 added T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements. S-Minor Impairs non-critical functionality or suitable workarounds exist labels May 16, 2022
@jaller94
Copy link
Contributor

Line in question:

log.error("Failed to run bridge.");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Minor Impairs non-critical functionality or suitable workarounds exist T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements.
Projects
None yet
Development

No branches or pull requests

2 participants