Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.43k stars 115 forks source link

Petra: broken CLI build #5164

Open kdembler opened 6 months ago

kdembler commented 6 months ago
$ graphql-codegen
/Users/kdembler/dev/joystream/monorepo/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/template/lib/index.js:53
      throw new Error("You must pass a scope and parentPath unless traversing a Program/File. " + `Instead of that you tried to traverse a ${parent.type} node without ` + "passing scope and parentPath.");
      ^

Error: You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a undefined node without passing scope and parentPath.
    at traverse (/Users/kdembler/dev/joystream/monorepo/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/template/lib/index.js:53:13)
    at Object.<anonymous> (/Users/kdembler/dev/joystream/monorepo/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/helper-function-name/lib/index.js:20:68)
    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 require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/kdembler/dev/joystream/monorepo/node_modules/@graphql-tools/graphql-tag-pluck/node_modules/@babel/traverse/lib/path/conversion.js:14:50)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)

After this PR: https://github.com/Joystream/joystream/pull/5157

ignazio-bovo commented 5 months ago

This is probably due to some babel dependency errors inside the graphql tools I have opened an issue on their repo: https://github.com/ardatan/graphql-tools/issues/6252 The error is fixed on the babel release. It now start to appear on the master branch which is very strange

ignazio-bovo commented 5 months ago

One solution to this is to apparently run the following sequence:

rm -fr node_modules/
rm -fr query-node/node_modules/
rm -fr query-node/codegen/node_modules/
yarn build:packages
mnaamani commented 5 months ago

That is the solution I always use when this issue pops up. Generally it happens when I'm switching branches often where there might be different graphql dependencies.

If you look at the query-node build script: https://github.com/Joystream/joystream/blob/master/query-node/build.sh You will observe codegen dependencies are treated a bit differently and we do some weird build steps to keep the main workspace dependencies different than codegen dependencies. This was necessary in the past, maybe not so much now that we have both using relatively the same versions..

Perhaps we can look into it in more detail