graphql-framework-experiment icon indicating copy to clipboard operation
graphql-framework-experiment copied to clipboard

Nexus build silently fails in CI environment with empty error

Open drewdecarme opened this issue 5 years ago • 4 comments

Screenshot

Aug 13 12:04:38 AM  $ nexus build
Aug 13 12:04:39 AM  {"event":"get used plugins","level":3,"path":["nexus","build"]}
Aug 13 12:04:40 AM  {"event":"Running generators","level":3,"path":["nexus","plugin","nexusPluginPrisma"]}
Aug 13 12:04:42 AM  {"event":"starting reflection","level":3,"path":["nexus","build"]}
Aug 13 12:04:43 AM  {"event":"reflection failed","level":6,"path":["nexus"],"context":{"error":{}}}

Description

I'm having some issues building Nexus in a CI environment. Everything works really well locally and I'm not having any problems. I am however using a mono-repo structure and am not having any issues with it. I've added another entry to my typeRoots in my tsconfig.json which just navigates up 2 directories into the hoisted node_modules folder.

Here's the tsconfig:

{
"compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "lib": ["esnext"],
    "rootDir": ".",
    "strict": true,
    "noEmit": true,
    "plugins": [{ "name": "nexus/typescript-language-service" }],
    "typeRoots": [
      "node_modules/@types",
      "types",
      "types.d.ts",
      "../../node_modules/@types"
    ]
  }
}

I've reverted to building it locally and unfortunately checked in my files, but I'd like to get it to build dynamically if at all possible in CI.

I'm going to go ahead and assume that it's something to do with the Lerna symlinking, but it's puzzling that it would work locally and not on CI... especially the reflection process.

Wondering if you could shed any light onto what the problem might be. Thanks!

Love the framework, it's a blast to use!

drewdecarme avatar Aug 13 '20 04:08 drewdecarme

I don't use a monorepo but I have a similar problem in GitLab CI. Local build works fine.

$ yarn nexus report
{"event":"Failed to scan app for used plugins because there is a runtime error in the app","level":6,"path":["nexus"],"context":{"error":{}}}

$ yarn nexus build
{"event":"get used plugins","level":3,"path":["nexus","build"]}
{"event":"failed to get used plugins","level":6,"path":["nexus"],"context":{"error":{}}}

benknab avatar Aug 15 '20 07:08 benknab

Nevermind, I had a config validation error because of a missing environment variable. The error log was missing in the CI environment that's why it took me so long to figure it out. Build works as expected now.

benknab avatar Aug 15 '20 12:08 benknab

I'm also running into this problem when building on github actions.

> nexus report

{"event":"Failed to scan app for used plugins because there is a runtime error in the app","level":6,"path":["nexus"],"context":{"error":{}}}

@bkiac How did you solve this?

ff6347 avatar Sep 17 '20 16:09 ff6347

@fabianmoronzirfas For me, the error was in my own application code. I forgot to include a required environment variable so my config validator threw an error. You could try to pass LOG_LEVEL=trace LOG_PRETTY=true (or only LOG_LEVEL=trace if you don't care about the formatting) environment variables to your process/command so you have more detailed error logs of the crash.

$ LOG_LEVEL=trace LOG_PRETTY=true nexus report

benknab avatar Sep 17 '20 18:09 benknab