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

Turborepo crashing with pre-commit hooks #8349

Closed
1 task done
EfstathiadisD opened this issue Jun 6, 2024 · 13 comments
Closed
1 task done

Turborepo crashing with pre-commit hooks #8349

EfstathiadisD opened this issue Jun 6, 2024 · 13 comments
Labels
kind: bug Something isn't working

Comments

@EfstathiadisD
Copy link

EfstathiadisD commented Jun 6, 2024

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

git commit -m ""

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

2.0.1, 2.0.2-canary.1

Describe the Bug

I have a pre-commit hook. I am using lefthook for it. I am using Biome for Linting and Vitest for testing. Here is the file..

pre-commit:
  parallel: true
  commands:
    fmt:
      run: pnpm fmt
    test:
      run: pnpm test

If I run a git commit -m "<COMMIT-MSG>" it crashes. But if I run the commands individually and then commit again it passes. Here are some Logs that turborepo prompted me to post..

   1   │ name = "turbo"
   2   │ operating_system = "Mac OS 14.4.1 [64-bit]"
   3   │ crate_version = "2.0.1"
   4   │ explanation = """
   5   │ file 'crates/turborepo-lib/src/commands/run.rs' at line 57
   6   │ """
   7   │ cause = "render thread panicked: JoinError::Panic(Id(26), ...)"
   8   │ method = "Panic"
   9   │ backtrace = """
  10   │
  11   │    0: 0x102deaaa4 - __mh_execute_header
  12   │    1: 0x1033a8d6c - __mh_execute_header
  13   │    2: 0x103419ec4 - __mh_execute_header
  14   │    3: 0x103415194 - __mh_execute_header
  15   │    4: 0x1035eabcc - __mh_execute_header
  16   │    5: 0x10381c850 - __mh_execute_header
  17   │    6: 0x103819108 - __mh_execute_header
  18   │    7: 0x103268ff4 - __mh_execute_header
  19   │    8: 0x103267ae4 - __mh_execute_header
  20   │    9: 0x1032686e0 - __mh_execute_header"""

Expected Behavior

I shouldn't need to run the commands individually in order for the commit hook to run the underline command without issue.

To Reproduce

I guess, we need a Monorepo with Pnpm, Turbo 2.0.1 and Lefthook. Important part here that this used to work as expected.

Additional context

No response

@EfstathiadisD EfstathiadisD added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels Jun 6, 2024
@akifunal
Copy link

akifunal commented Jun 6, 2024

We are also encountering errors during the commit phase when using Lefthook with Turbo 2.0.1

@NicholasLYang
Copy link
Contributor

Hi, this is a duplicate of #8323, this should be fixed in the latest canary (2.0.2-canary.0). Feel free to re-open the issue if that's not the case.

@EfstathiadisD
Copy link
Author

I tried with a Canary after what y suggested. It's not working.

@NicholasLYang
Copy link
Contributor

Gotcha, could you try adding TURBO_UI=0 to the turbo command?

@NicholasLYang NicholasLYang reopened this Jun 6, 2024
@anthonyshew anthonyshew changed the title Turborepo crashed Turborepo crashing with pre-commit hooks Jun 6, 2024
@EfstathiadisD
Copy link
Author

Yeah, with the old UI it is working.. I can leave with that for now.. Thanks!

@chris-olszewski
Copy link
Member

parallel: true

Can you remove this line and see if that changes anything?

Could you also try to provide a minimal reproduction repo?

@EfstathiadisD
Copy link
Author

parallel: true

Can you remove this line and see if that changes anything?

Could you also try to provide a minimal reproduction repo?

It's not working even without parallel. For the repro, I will try tomorrow evening as I am away from computer for a couple days. Sorry!

@thomasfr
Copy link

I can confirm the bug with Turbo 2.0.3 on macOS. It did work prior 2.x

my lefthook.yml:

pre-commit:
  parallel: false
  commands:
    check:
      run: pnpm run check

pre-push:
  parallel: true
  commands:
    check:
      run: pnpm run check
    test:
      run: pnpm run test
name = "turbo"
operating_system = "Mac OS 14.5.0 [64-bit]"
crate_version = "2.0.3"
explanation = """
file 'crates/turborepo-lib/src/commands/run.rs' at line 57
"""
cause = "render thread panicked: JoinError::Panic(Id(24), ...)"
method = "Panic"
backtrace = """

   0: 0x104d2eaa4 - __mh_execute_header
   1: 0x1052ecdec - __mh_execute_header
   2: 0x10535d7f4 - __mh_execute_header
   3: 0x105358e4c - __mh_execute_header
   4: 0x10573bd88 - __mh_execute_header
   5: 0x10577edc4 - __mh_execute_header
   6: 0x10577b4dc - __mh_execute_header
   7: 0x1051ace68 - __mh_execute_header
   8: 0x1051ab958 - __mh_execute_header
   9: 0x1051ac554 - __mh_execute_header"""

@takakikasuga
Copy link

takakikasuga commented Jun 13, 2024

me too, in this issue!

I can confirm the bug with Turbo 2.0.3 on macOS.

turbo: 2.0.3
lefthook: 1.6.15

lefthook.yml:

# EXAMPLE USAGE:
#
#   Refer for explanation to following link:
#   https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
pre-push:
  commands:
    # type-check:
    #   tags: type check
    #   run: yarn type:check

pre-commit:
  parallel: true
  commands:
    # eslint:
    #   tags: lint code
    #   run: yarn lint
    format:
      tags: format code
      run: yarn format

and then this error log generated

name = "turbo"
operating_system = "Mac OS 14.5.0 [64-bit]"
crate_version = "2.0.3"
explanation = """
file 'crates/turborepo-lib/src/commands/run.rs' at line 57
"""
cause = "render thread panicked: JoinError::Panic(Id(36), ...)"
method = "Panic"
backtrace = """

   0: 0x10020b535 - __mh_execute_header
   1: 0x1008f38ef - __mh_execute_header
   2: 0x10097f8e3 - __mh_execute_header
   3: 0x10097c0fe - __mh_execute_header
   4: 0x100c7f0e1 - __mh_execute_header
   5: 0x100ddb195 - __mh_execute_header
   6: 0x100dd6573 - __mh_execute_header
   7: 0x100775887 - __mh_execute_header
   8: 0x1007743a6 - __mh_execute_header
   9: 0x100774eca - __mh_execute_header"""

luckly, i add this env, I fix the bug, but i can use new turbo ui.

TURBO_UI=0 turbo <command_lines>

#8349 (comment)

@chris-olszewski
Copy link
Member

Could everyone who encountered this issue try to use 2.0.4-canary.3? #8457 should address the issue

@chris-olszewski chris-olszewski removed the needs: triage New issues get this label. Remove it after triage label Jun 13, 2024
@EfstathiadisD
Copy link
Author

EfstathiadisD commented Jun 14, 2024

Could everyone who encountered this issue try to use 2.0.4-canary.3? #8457 should address the issue

That worked but I don't think it used the new UI when running via the git hook.. Maybe I am wrong though.

@NicholasLYang
Copy link
Contributor

Yeah, that's intentional. Pre-commit tools like left hook open up a fake terminal that doesn't play well with our new UI. Unfortunately that does mean we need to fall back to the previous stream output

@mehulkar
Copy link
Contributor

Looks like this is resolved, closing.

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

7 participants