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

@cardano-graphql/cli - TypeError: Cannot read property 'trim' of undefined #552

Closed
3 tasks done
CyberCyclone opened this issue Jul 27, 2021 · 6 comments · Fixed by #560
Closed
3 tasks done

@cardano-graphql/cli - TypeError: Cannot read property 'trim' of undefined #552

CyberCyclone opened this issue Jul 27, 2021 · 6 comments · Fixed by #560
Assignees
Labels
waiting on author Have asked for more information, next action on the author

Comments

@CyberCyclone
Copy link

CyberCyclone commented Jul 27, 2021

Environment

 os: {
    arch: 'x64',
    cpus: { count: 12, model: 'AMD Ryzen 9 3900X 12-Core Processor' },
    release: '5.4.0-80-generic',
    totalMem: 24624054272,
    type: 'Linux'
  },
  version: '4.0.0'
}

cardano-graphql: 4.0.0

Platform

  • Linux / Ubuntu (Hyper-V machine on Windows 10)

Platform version:

Runtime

  • Node.js
  • Docker

Runtime version:

node -v: v14.17.2
docker version: 20.10.7

Steps to reproduce the bug

  1. Installed with sudo npm i -g @cardano-graphql/cli@4.0.0
  2. cd cardano-graphql
  3. sudo cgql docker snapshot make. Spits out the below:
TypeError: Cannot read property 'trim' of undefined
    at /usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:72:38
    at Array.map (<anonymous>)
    at Object.mapPsOutput (/usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:68:10)
    at Object.<anonymous> (/usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:341:36)
    at step (/usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:44:23)
    at Object.next (/usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:25:53)
    at fulfilled (/usr/lib/node_modules/@cardano-graphql/cli/node_modules/docker-compose/dist/index.js:16:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

What is the expected behavior?

Not sure, trying it out for the first time, but was expecting it to write backups of the docker volumes or something.

@rhyslbw
Copy link
Contributor

rhyslbw commented Jul 28, 2021

I'm not able to reproduce this with npx

npx @cardano-graphql/cli@4.0.0 docker snapshot make
                      _ 
                     | |
  ____   ____   ____ | |
 / ___) / _  | / _  || |
( (___ ( ( | || | | || |
 \____) \_|| | \_|| ||_|
       (_____|    |_|   
Snapshotting service cardano-db-sync 
./
Snapshotting service cardano-node 
./
Snapshotting service postgres 
./
Snapshot complete 

Have you installed the package globally before? If so, try

npm uninstall -g @cardano-graphql/cli@4.0.0
npm i -g @cardano-graphql/cli@5.0.0

@rhyslbw rhyslbw added the waiting on author Have asked for more information, next action on the author label Jul 31, 2021
@rhyslbw rhyslbw self-assigned this Jul 31, 2021
@CyberCyclone
Copy link
Author

It seems to work fine running with npx instead of installing it: npx @cardano-graphql/cli@4.0.0 docker snapshot make.

I've stuck with @4.0.0 as that's the cardano-graphql version I'm using currently. Not sure if it's good to mix the versions.

@CherryDT
Copy link
Contributor

CherryDT commented Aug 6, 2021

Same issue here (also same stack trace), I'm getting this when trying to rebuild the DB as part of the upgrade from 4.0.0 to 5.0.0 - but for me it fails also with npx. Can this please be reopened?

@CherryDT
Copy link
Contributor

CherryDT commented Aug 6, 2021

It seems it's because output (the result of docker-compose -q) is like this:

065dc1dae8bd993cd29320b9138051e4869bf992dd1e34c7e8efe57e2eccb6d7
2c07dafe5bd2cca3e2ba788fc6af8a1e52b4876e2d7d72fa499870a13ce5067f
9bbe65e35776f14ef921fd0b4974b364a2b2f90fd8a6dbb0718c3da6349a293b
09767fb95d0e95d8d225c379cea88484c5012e4851915a4bb976917a2e4e25cb
b261e772cd22106827098269f566817e39fa75380131e6a84192b39790636c5a

The code then splits this to lines and then splits the lines by 3+ spaces and expects apparently more than one "thing" on the line, but there isn't.

Since the variables are called nameFragment, commandFragment, etc. I assume you want to call docker-compose ps without the -q switch...

@CherryDT
Copy link
Contributor

CherryDT commented Aug 6, 2021

...I see now this is actually in a dependency, the culprit is this commit: PDMLab/docker-compose@880d252

It breaks compatibility with -q.

Opened an issue upstream: PDMLab/docker-compose#178

CherryDT added a commit to CherryDT/cardano-graphql that referenced this issue Aug 7, 2021
@rhyslbw rhyslbw reopened this Aug 9, 2021
CherryDT added a commit to CherryDT/cardano-graphql that referenced this issue Aug 9, 2021
rhyslbw added a commit that referenced this issue Aug 11, 2021
Co-authored-by: Rhys Bartels-Waller <rhys.bartelswaller@iohk.io>
@AlexZeitler
Copy link

👋 Just wanted to let you know that today we've released version 0.23.15 which should fix this issue.

Looking forward to your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on author Have asked for more information, next action on the author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants