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

panic: runtime error: invalid memory address or nil pointer dereference #167

Closed
raulfdm opened this issue Dec 10, 2021 · 3 comments
Closed
Labels
kind: bug Something isn't working

Comments

@raulfdm
Copy link

raulfdm commented Dec 10, 2021

What version of Turborepo are you using?

1.0.4

Describe the Bug

I'm trying out turborepo in my existing monorepo that uses pnpm workspaces, and when I define a specific packages task, I get the following error:

~/development/raulmelo-studio(test-turbo-repo*) » npx turbo run build --scope=website
• Packages in scope: website
• Running build in 1 packages
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x13fa6c8]

goroutine 114 [running]:
turbo/internal/run.(*RunCommand).Run.func3({0xc0000a9880, 0xa})
        /Users/jared/dev/vercel/turbo/cli/internal/run/run.go:375 +0x188
turbo/internal/core.(*scheduler).Execute.func1({0x1443e40, 0xc0006b0cd0})
        /Users/jared/dev/vercel/turbo/cli/internal/core/scheduler.go:107 +0x1bd
github.com/pyr-sh/dag.(*Walker).walkVertex(0xc00049fe60, {0x1443e40, 0xc0006b0cd0}, 0xc00068a300)
        /Users/jared/go/pkg/mod/github.com/pyr-sh/dag@v1.0.0/walk.go:377 +0x2ff
created by github.com/pyr-sh/dag.(*Walker).Update
        /Users/jared/go/pkg/mod/github.com/pyr-sh/dag@v1.0.0/walk.go:300 +0xf85

Config

I'm not sure if my config is correct though:

{
"turbo": {
    "baseBranch": "origin/main",
    "pipeline": {
      "lint": {},
      "build": {
        "outputs": [
          "dist/**",
          ".next",
          "functions/**",
          "build/**"
        ]
      },
      "test": {
        "outputs": [
          "coverage/**"
        ]
      },
      "website#build": {
        "dependsOn": [
          "core#build",
          "mdx-prism-2#build"
        ]
      }
    }
  }
}

What I want to accomplish

Since my website rely on packages/core and packages/mdx-prism-2, I want to test/build them first and only then build the website.

Expected Behavior

Running the pipeline or at least getting a handled error message.

To Reproduce

The PR I'm trying this is the following: raulfdm/raulmelo-studio#1141

If this is not only a matter of configure stuff, I can try to recreate a smaller version of my repository. Even though it's open source, building rely on .env files.

@jaredpalmer
Copy link
Contributor

Going to look into the nil pointer issue, but i I think you want to add regardless:

"build": {
   "dependsOn":["^build"],
}

this makes sure deps are built first. I also think you probably want to set lint's outputs: [] so that you don't cache dist or build folders needlessly while linting

@jaredpalmer jaredpalmer added the kind: bug Something isn't working label Dec 10, 2021
@raulfdm
Copy link
Author

raulfdm commented Dec 16, 2021

Hey @jaredpalmer ... I've notice that the pointer problem was caused by the website#build configuration. When I remove it it just works.

{
  "turbo": {
    "baseBranch": "origin/main",
    "pipeline": {
      "lint": {
        "outputs": []
      },
      "build": {
        "dependsOn": [
          "^build"
        ],
        "outputs": [
          "dist/**",
          ".next",
          "functions/**",
          "build/**"
        ]
      },
      "test": {
        "outputs": [
          "coverage/**"
        ]
      }
    }
  }
}

@Adjective-Object
Copy link

Also ran into this issue when I had a misspecified turbo.json. I think this will happen whenever you have a specific package#task dependency with a task not in your graph.

For the sake of completeness, here's an abbreviated before/after config. In my repo, all tests depend on a shared jest config package named @adj/jest-config.

Failing:

{
    "pipeline": {
        "transpile.cjs": {
            "dependsOn": ["^transpile.cjs", "rust.build.ts-bindings"]
        },
        "test": {
            "dependsOn": ["jest-config#transpile.cjs"],
            "outputs": []
        }
    }
}

working:

{
    "pipeline": {
        "transpile.cjs": {
            "dependsOn": ["^transpile.cjs", "rust.build.ts-bindings"]
        },
        "test": {
            "dependsOn": ["@adj/jest-config#transpile.cjs"],
            "outputs": []
        }
    }
}

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants