GaloyMoney / blink

bitcoin banking infrastructure
https://galoy.io
MIT License
368 stars 138 forks source link

Error while starting the servers in subBlocks trigger #627

Closed AlaaTarekHariry closed 2 years ago

AlaaTarekHariry commented 3 years ago

Hello there, I got the following error on my local machine at the step sudo make start :

$ sudo make start
$ docker-compose up -d
WARNING: The PWD variable is not set. Defaulting to a blank string.
Creating network "galoy_default" with the default driver
Creating galoy_price_1    ... done
Creating galoy_bitcoind_1 ... done
Creating galoy_mongodb_1  ... done
Creating galoy_redis_1    ... done
Creating galoy_lnd2_1          ... done
Creating galoy_lnd-outside-1_1 ... done
Creating galoy_lnd-outside-2_1 ... done
Creating galoy_lnd1_1          ... done
direnv reload
make start-old & make start-new & make start-admin & make trigger
make[1]: Entering directory `/home/ec2-user/gdev1dev/galoy'
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-old-server.ts | yarn pino-pretty -c -l
make[1]: Entering directory `/home/ec2-user/gdev1dev/galoy'
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-main-server.ts | yarn pino-pretty -c -l
make[1]: Entering directory `/home/ec2-user/gdev1dev/galoy'
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-admin-server.ts | yarn pino-pretty -c -l
make[1]: Entering directory `/home/ec2-user/gdev1dev/galoy'
docker-compose up -d
galoy_mongodb_1 is up-to-date
galoy_price_1 is up-to-date
Recreating galoy_bitcoind_1 ... 
Recreating galoy_bitcoind_1 ... done
Recreating galoy_lnd2_1          ... done
Recreating galoy_lnd1_1          ... done
Recreating galoy_lnd-outside-2_1 ... done
Recreating galoy_lnd-outside-1_1 ... done
direnv reload
. ./.envrc && yarn tsnd --respawn --files -r tsconfig-paths/register src/servers/trigger.ts | yarn pino-pretty -c -l
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/pino-pretty -c -l
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-old-server.ts
[INFO] 20:56:21 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.3.5)
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/pino-pretty -c -l
yarn run v1.22.11
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/tsnd --respawn --files -r tsconfig-paths/register src/servers/trigger.ts
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/pino-pretty -c -l
yarn run v1.22.11
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-main-server.ts
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/pino-pretty -c -l
yarn run v1.22.11
$ /home/ec2-user/gdev1dev/galoy/node_modules/.bin/tsnd --respawn --files -r tsconfig-paths/register src/servers/graphql-admin-server.ts
[INFO] 20:56:23 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.3.5)
[INFO] 20:56:24 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.3.5)
[INFO] 20:56:24 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.3.5)
INFO [1633640234732] (13694 on ip-172-31-5-209.eu-west-2.compute.internal): Health check listening on port 8888!
    module: "trigger"
(node:13694) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
(Use `node --trace-deprecation ...` to show where the warning was created)
INFO [1633640244955] (13694 on ip-172-31-5-209.eu-west-2.compute.internal): lnd started
    socket: "127.0.0.1:10010"
INFO [1633640244961] (13694 on ip-172-31-5-209.eu-west-2.compute.internal): lnd started
    socket: "127.0.0.1:10009"
ERROR [1633640244974] (13694 on ip-172-31-5-209.eu-west-2.compute.internal): error subBlocks
    err: [
      503,
      "ExpectedHeightInBlockEvent"
    ]
Error: 1 CANCELLED: Cancelled on client
    at Object.callErrorFromStatus (/home/ec2-user/gdev1dev/galoy/node_modules/lightning/node_modules/@grpc/grpc-js/src/call.ts:81:24)
    at Object.onReceiveStatus (/home/ec2-user/gdev1dev/galoy/node_modules/lightning/node_modules/@grpc/grpc-js/src/client.ts:574:32)
    at Object.onReceiveStatus (/home/ec2-user/gdev1dev/galoy/node_modules/lightning/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
    at /home/ec2-user/gdev1dev/galoy/node_modules/lightning/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
[ERROR] 20:57:25 Error: 1 CANCELLED: Cancelled on client

Also does the react app of galoy needs only to connect to machine's port 4000 ?

dolcalmi commented 3 years ago

did you test running without sudo?

AlaaTarekHariry commented 3 years ago

did you test running without sudo?

i switched to root and run it without sudo. but same error occure at the end.

nicolasburtey commented 2 years ago

eu-west-2 seems to come from a test on a AWS? can you confirm @AlaaTarekHariry ? if you can share the config you used it will be easy to reproduce/fix it

AlaaTarekHariry commented 2 years ago

@nicolasburtey I tested that on aws and local machine with default configurations with same error appears. Only when i convert to root the graphql servers up and running otherwise it didn't run. Still have same error even switching to root user.

nicolasburtey commented 2 years ago

which OS/distro are you using locally? or which aws AMI?

AlaaTarekHariry commented 2 years ago

Ubuntu 20 lts

dolcalmi commented 2 years ago

I could reproduce the error. please check https://github.com/alexbosworth/lightning/blob/master/lnd_methods/onchain/subscribe_to_blocks.js#L85

basically if bitcoind has not sync at least 1 block then you will get that error.

@AlaaTarekHariry what bitcoin network are you using?

AlaaTarekHariry commented 2 years ago

@dolcalmi i don't connect it. I only put twilio credentials in environment file. where and what is the bitcoin connection network variables?

dolcalmi commented 2 years ago

@AlaaTarekHariry please notice that docker is only used for dev environment, if you want to deploy a production environment please check https://github.com/GaloyMoney/galoy-infra/ and https://github.com/GaloyMoney/charts

if still you want to use docker please check/modify configs in .envrc and configs for bitcoind and lnd in dev folder

dolcalmi commented 2 years ago

for future reference, if you want to test locally with regtest you can run TEST="01|02" make reset-integration