-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] ERROR run failed: Failed to add workspace "" #3340
Comments
Hey @g-farrow, sorry for the issue here. It looks like it's caused by this: #2659 (cc @mehulkar) Do all of your workspaces have a unique Interestingly this looks like it's picking up build output as workspaces (paths have .next), could you share your app structure and |
Not to hijack this issue, but I was also getting this error and it forced me to downgrade to 1.6.3. In my case, we have a |
Not at all, thanks for the extra info @c-kirkeby. I'll take a look at getting a reproduction together tomorrow. |
I have the same issue using pnpm 7.19.0 and turbo 1.7.0: |
Hey all! Apologies for the inconvenience, and thanks for the reports! Can you confirm that in each of your cases, the two workspaces mentioned int he error message are both missing the I'm submitting a "fix" in #3375, but it actually feels like creating a worse bug to fix this. As you may be able to tell, our WorkspaceGraph uses the name of the workspace to keep track of it. Workspaces with the same name (even if they are In any case, it seems like things were "working" for you before. Could you confirm that
If the last one is true, I'd love to hear why as well. We may need to consider using switching to paths instead of names, if that's the case. |
In my case at least, they don't have missing names. They each have unique name fields in package.json with the format |
@c-kirkeby a repro would be very helpful, thank you! (Also feel free to try the patch in #3375 just to see if it solves your issue, even though we may not have found the cause. |
@mehulkar I also have names set in each packages:
- "apps/**"
- "packages/**"
- "services/**" Rolling back to v1.6.3 resolves the problem for me as well, so it looks like a problem released in v1.7.0? |
It definitely looks like an issue with 1.7, just trying to narrow down the problem, since I can't think of a scenario where this error would come into play other than missing names. Not to say I don't believe you, but any chance I can get my hands on your repo so I can do some good old debugging? Happy to pair / get a private drop of the codebase as well, if a minimal repro is not easy to make. |
I wasn't able to reproduce this one either. I was suspicious of turbo picking up the A simple reproduction would be awesome! |
Please find the repo here: https://github.com/c-kirkeby/turbo-next-reproduction This was created simply by using The issue is replicated by running |
That was really helpful @c-kirkeby, thank you!
You solved the bug! (at least yours, that is). As mentioned in the #2659 exposed the bug that all these workspaces are being added into Turbo's graph. However, since they don't define any There are a few things we can do:
I'll float this to the rest of the team, but in the meantime, this should fix your issue: packages:
- - "apps/**"
- - "packages/**"
+ - "apps/*"
+ - "packages/*" |
I think we should warn on a detected package with a missing name, exclude it from the graph, and continue (don't panic). |
Spoke about this internally and came to the conclusion that:
IMO, some good options going forward are:
|
Thanks for the workaround options. I can confirm that @c-kirkeby you workaround works for me (changing @mehulkar I think both of the options you've suggested are good. Improving error messaging is always helpful. But ignoring git ignored paths makes a lot of sense to me and is, I think, fairly intuitive as well. |
just so I understand, what do you mean by this? “Your implementation” refers to turborepo’s solution for this problem? Or a consuming monorepo’s setup? In either case, what are the undesirable effects of changing to a single star? |
As an extension to this problem: I ran into the following errors; We make a copy of the package.json into the dist folder for publishing, which is also recognized as workspace. So I tried to exclude all dist folders as workspaces with the following: "workspaces": [
"apps/**",
"packages/**/!(dist)"
], However, Turbo stopped recognizing all workspaces in the |
I meant the monorepo's setup. PNPM config allows both |
Turborepo identifies each workspace in the monorepo by its package name. Workspaces with no `name` field are identified as empty string package names. This causes package name conflicts when multiple workspaces exist for which the `name` field is not present. see vercel/turbo#3340
* build(npm-scripts): introduce Turborepo Introduce a new build system Turborepo that caches based on file content. see https://turbo.build/repo * chore(package.json): add `name` field within all `package.json` Turborepo identifies each workspace in the monorepo by its package name. Workspaces with no `name` field are identified as empty string package names. This causes package name conflicts when multiple workspaces exist for which the `name` field is not present. see vercel/turbo#3340 * build: use Turborepo instead of ultra-runner * build(turborepo): `turbo run` commands should not be executed directly in subdirectories The `turbo run` command seems to be intended only to be executed in the monorepo root directory. In `[email protected]`, the `turbo run` command cannot be executed in a subdirectory of a monorepository. Note: To be precise, this is the case for subdirectories where `turbo.json` files exist. * chore(npm-scripts): use ultra-runner instead of Turborepo for linting and testing Turborepo does not correctly display the output of the task on the console. Turborepo's output disables ANSI escaping of the command being executed and does not display animations and/or colors. In addition, the task log lines are longer due to the addition of ugly prefixes. Turborepo's cache strategy is superior to Ultra Runner. However, the output to the console is better with Ultra Runner. In linting and testing, we prioritize console readability over execution speed and cache. * chore(debug): remove debug codes unintentionally mixed in * chore(github): set syntax highlighting of `turbo.json` file to JSON with Comments
I've solved this issue by adding the following ignore rules to my packages:
- "apps/**"
- "packages/**"
- "!**/.next/**" # NEW
- "!**/dist/**" # NEW |
Sadly does not work yarn or npm |
@mehulkar In response for your request for feedback on this issue: I just spent a couple hours bewildered why turbo wouldn't run my tasks with a bare bones setup. Then I stumbled on this issue – only then did I realize omitting My opinion is all Two possible ways I think the turbo experience could be improved here:
I definitely think libraries must have |
@leontastic can you open a new issue? I think it's worth revisiting, especially since we're gearing up for 2.0 which has the luxury of including breaking changes, but I'd like to look at it with fresh eyes instead of as part of this issue. |
What version of Turborepo are you using?
1.7.0
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Describe the Bug
Following upgrading from 1.6.3 to 1.7.0 I have noticed that turbo now consistently fails to run my deployment command giving the following error:
This is being run in GitHubActions on a standard ubuntu image. The build command runs ok (which runs this script in the two affected workspaces:
"build:export": "next build && next export",
.The turbo command which is failing is supposed to run this script command in the workspaces:
"deploy": "cdk deploy --all --require-approval never --outputs-file ./cdk-outputs.json -c env=production && ts-node cdk/helpers/upload-source-maps.ts",
Expected Behavior
The command should execute successfully, as it was doing in 1.6.3.
To Reproduce
I'm unsure as I am not clear on the cause. I did notice that some changes were made in 1.7.0 which affect how workspaces are parsed, perhaps this has introduced a problem when using pnpm?
Reproduction Repo
No response
The text was updated successfully, but these errors were encountered: