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

fix: avoid errors if Loop is not enabled #1733

Closed
wants to merge 3 commits into from

Conversation

openoms
Copy link
Collaborator

@openoms openoms commented Oct 3, 2022

Currently Loop is not running on signet lightninglabs/loop#522 so will needed to keep it off in GaloyMoney/charts#1125.

Fixing the error when deploying on signet with Loop disabled:

{"level":30,"time":1666863947270,"pid":1,"hostname":"api-97c4b8f8d-b4j5h","msg":"loading custom.yaml"}
/app/lib/config/process.js:88
        throw new error_1.ConfigError("Missing LND1_LOOP_TLS config");
        ^

ConfigError: Missing LND1_LOOP_TLS config
    at getLoopConfig (/app/lib/config/process.js:88:15)
    at Object.<anonymous> (/app/lib/app/swap/get-active-loopd.js:27:42)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39) {
  data: undefined
}

Node.js v18.11.0
k3d@z420:~/charts/dev$ k -n galoy-sig-galoy   logs  api-97c4b8f8d-b4j5h -f
Defaulted container "api" out of: api, wait-for-mongodb-migrate (init)
{"level":30,"time":1666863947270,"pid":1,"hostname":"api-97c4b8f8d-b4j5h","msg":"loading custom.yaml"}
/app/lib/config/process.js:88
        throw new error_1.ConfigError("Missing LND1_LOOP_TLS config");
        ^

ConfigError: Missing LND1_LOOP_TLS config
    at getLoopConfig (/app/lib/config/process.js:88:15)
    at Object.<anonymous> (/app/lib/app/swap/get-active-loopd.js:27:42)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39)
    at Hook._require.Module.require (/app/node_modules/require-in-the-middle/index.js:80:39) {
  data: undefined
}

Node.js v18.11.0

@ntheile
Copy link
Contributor

ntheile commented Oct 3, 2022

should probably also add an if statement for cronConfig.swapEnabled in the

trigger.ts server - https://github.com/GaloyMoney/galoy/blob/main/src/servers/trigger.ts#L409-L412

@openoms openoms marked this pull request as draft October 4, 2022 09:19
@openoms openoms changed the title fix: return empty loop values on signet fix: avoid errors if Loop is not enabled Oct 26, 2022
@openoms openoms force-pushed the nolooponsignet branch 2 times, most recently from 60f2e0c to 24fefbc Compare October 26, 2022 10:49
@openoms openoms marked this pull request as ready for review October 27, 2022 11:32
throw new ConfigError("Missing LND1_LOOP_MACAROON config")
if (!process.env.LND2_LOOP_MACAROON)
throw new ConfigError("Missing LND2_LOOP_MACAROON config")
if (getCronConfig().swapEnabled) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be part of service validation

@@ -41,6 +43,9 @@ export const LoopService = ({
lndInstanceName,
}: LoopdConfig): ISwapService => {
const mac = Buffer.from(macaroon, "base64").toString("hex") as Macaroon
if (!tlsCert) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably here should be the validation, also service should not throw exceptions. Please check onchain service as example

@openoms
Copy link
Collaborator Author

openoms commented Oct 27, 2022

@dolcalmi thank you for the comments, will copy the over to #1891 which replaced this PR to be on a GaloyMoney branch

@openoms openoms closed this Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants