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

Found an unknown key tasks when pruning #8368

Closed
1 task done
imprakharshukla opened this issue Jun 7, 2024 · 6 comments
Closed
1 task done

Found an unknown key tasks when pruning #8368

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

Comments

@imprakharshukla
Copy link

Verify canary release

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

Link to code that reproduces this issue

https://github.com/imprakharshukla/turbo-docker-repro

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.3-canary.0

Describe the Bug

When running turbo prune <project> --docker, the turbo does not recognise the tasks property in the turbo.json.

0.102 Error: turbo_json_parse_error
0.102 
0.102   x Found an unknown key `tasks`.
0.102    ,-[2:1]
0.102  2 |   "$schema": "https://turbo.build/schema.json",
0.102  3 |   "tasks": {
0.102    :   ^^^^^^^
0.102  4 |     "build": {
0.102    `----
0.102 
------

It was working on 1.x.x.

Expected Behavior

It should prune the app for a docker build as it did in ver. 1.x

To Reproduce

  1. Clone the repo.
  2. Run docker build --build-arg PROJECT="app-a" .

Additional context

This started happening on 2.x builds, it was working fine before.

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

Is the --scope flag removed? If I replace --scope with --filter it works. I am aware that I can cd into the app and use the auto-scoping but I just wanted to know if it is removed since I could not find it in the changelog of 2.0.

@joakim-roos
Copy link

Having the same issue when building on Docker.

RUN turbo prune --scope=${PROJECT} --docker
│  > [pruner 3/3] RUN turbo prune --scope=@monorepo/remix --docker:
│ 0.147 Error: turbo_json_parse_error
│ 0.147
│ 0.147   x Found an unknown key `tasks`.
│ 0.147    ,-[3:1]
│ 0.147  3 |     "globalDependencies": ["**/.env.*local", "**/.env"],
│ 0.147  4 |     "tasks": {
│ 0.147    :     ^^^^^^^
│ 0.147  5 |         "topo": {
│ 0.147    `----
│ 0.147

@joakim-roos
Copy link

joakim-roos commented Jun 7, 2024

RUN turbo prune ${PROJECT} --docker

Also fails with:

│ #13 [pruner 3/3] RUN turbo prune --docker @monorepo/remix
│ #13 0.092
│ #13 0.092 Attention:
│ #13 0.092 Turborepo now collects completely anonymous telemetry regarding usage.
│ #13 0.092 This information is used to shape the Turborepo roadmap and prioritize features.
│ #13 0.092 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting th
│ e following URL:
│ #13 0.092 https://turbo.build/repo/docs/telemetry
│ #13 0.092
│ #13 0.119 Generating pruned monorepo for @monorepo/remix in /app/out
│ #13 0.120  - Added @monorepo/cc
│ #13 0.121  - Added @monorepo/utils
│ #13 0.121  - Added @monorepo/http-client
│ #13 0.121  - Added @monorepo/invariant
│ #13 0.125  - Added @monorepo/remix
│ #13 0.126  - Added @monorepo/storage
│ #13 0.126  - Added @monorepo/tsconfig
│ #13 0.129  - Added @monorepo/ui
│ #13 0.142 turbo_json_parse_error
│ #13 0.142
│ #13 0.142   x failed to parse turbo json
│ #13 0.142
│ #13 0.142 Error: turbo_json_parse_error
│ #13 0.142
│ #13 0.142   x Found an unknown key `tasks`.
│ #13 0.142    ,-[3:1]
│ #13 0.142  3 |     "globalDependencies": ["**/.env.*local", "**/.env"],
│ #13 0.142  4 |     "tasks": {
│ #13 0.142    :     ^^^^^^^
│ #13 0.142  5 |         "topo": {
│ #13 0.142    `----
│ #13 0.142
│ #13 ERROR: process "/bin/sh -c turbo prune --docker ${PROJECT}" did not complete successfully: exit code: 1
│ ------
│  > [pruner 3/3] RUN turbo prune --docker @monorepo/remix:
│ 0.142 Error: turbo_json_parse_error
│ 0.142
│ 0.142   x Found an unknown key `tasks`.
│ 0.142    ,-[3:1]
│ 0.142  3 |     "globalDependencies": ["**/.env.*local", "**/.env"],
│ 0.142  4 |     "tasks": {
│ 0.142    :     ^^^^^^^
│ 0.142  5 |         "topo": {
│ 0.142    `----
│ 0.142
│ ------
│ Dockerfile:24
│ --------------------
│   22 |     WORKDIR /app
│   23 |     COPY . .
│   24 | >>> RUN turbo prune --docker ${PROJECT}
│   25 |
│   26 |     # 3. Build the project
│ --------------------
│ ERROR: failed to solve: process "/bin/sh -c turbo prune --docker ${PROJECT}" did not complete successfully: exit code: 1
│
...
...

@joakim-roos
Copy link

All examples except the one with docker is updated: https://github.com/vercel/turbo/tree/main/examples/with-docker

@chris-olszewski
Copy link
Member

chris-olszewski commented Jun 7, 2024

I believe this is some issue with your machine's NPM registry cache where this line is installing turbo@^1 instead of latest. Could you try changing this to RUN npm install turbo@^2 --global

On my machine the command succeeds with prune, but fails on db:generate since it isn't defined:

[1 olszewski@chriss-mbp] /tmp/turbo-docker-repro $ docker build --build-arg PROJECT="app-a" .
[+] Building 14.8s (18/24)                                                                                                                             
 => [internal] load build definition from Dockerfile                                                                                              0.0s
 => => transferring dockerfile: 1.74kB                                                                                                            0.0s
 => [internal] load .dockerignore                                                                                                                 0.0s
 => => transferring context: 2B                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/node:18.17.0-alpine                                                                            1.7s
 => [alpine 1/4] FROM docker.io/library/node:18.17.0-alpine@sha256:58878e9e1ed3911bdd675d576331ed8838fc851607aed3bb91e25dfaffab3267               6.0s
 => => resolve docker.io/library/node:18.17.0-alpine@sha256:58878e9e1ed3911bdd675d576331ed8838fc851607aed3bb91e25dfaffab3267                      0.0s
 => => sha256:c26744d3fbd431d27f9e3528f9ac0ed6dc06279b665accbf2ede5890bf74c3aa 6.75kB / 6.75kB                                                    0.0s
 => => sha256:9fda8d8052c61740409c4bea888859c141fd8cc3f58ac61943144ff6d1681b2d 3.33MB / 3.33MB                                                    0.4s
 => => sha256:7d4cdfcea0f4a3353e86a42299735d74f5ad32689daa6a404be660a2cbbe9b16 47.49MB / 47.49MB                                                  4.3s
 => => sha256:89153c2109fe92bf2c987e3b78567aa51da89f777363b13ffda03b01d89730d7 2.34MB / 2.34MB                                                    0.8s
 => => sha256:58878e9e1ed3911bdd675d576331ed8838fc851607aed3bb91e25dfaffab3267 1.43kB / 1.43kB                                                    0.0s
 => => sha256:42efd5eb413909b3127abf65f58bfb1b28312441e38bb382e262b520d5b9a051 1.16kB / 1.16kB                                                    0.0s
 => => extracting sha256:9fda8d8052c61740409c4bea888859c141fd8cc3f58ac61943144ff6d1681b2d                                                         0.1s
 => => sha256:68773a294a294db6259757b1899be50fcebf8ef1bd697d7e9465c4909ef300ad 448B / 448B                                                        0.6s
 => => extracting sha256:7d4cdfcea0f4a3353e86a42299735d74f5ad32689daa6a404be660a2cbbe9b16                                                         1.4s
 => => extracting sha256:89153c2109fe92bf2c987e3b78567aa51da89f777363b13ffda03b01d89730d7                                                         0.1s
 => => extracting sha256:68773a294a294db6259757b1899be50fcebf8ef1bd697d7e9465c4909ef300ad                                                         0.0s
 => [internal] load build context                                                                                                                 0.2s
 => => transferring context: 52.60kB                                                                                                              0.1s
 => [alpine 2/4] RUN apk update                                                                                                                   0.7s
 => [alpine 3/4] RUN apk add --no-cache libc6-compat                                                                                              0.6s
 => [alpine 4/4] RUN corepack enable                                                                                                              0.3s 
 => [base 1/1] RUN npm install turbo --global                                                                                                     1.6s 
 => [runner 1/4] WORKDIR /app                                                                                                                     0.0s 
 => [builder 1/9] WORKDIR /app                                                                                                                    0.0s 
 => [pruner 2/3] COPY . .                                                                                                                         0.0s
 => [pruner 3/3] RUN turbo prune app-a --docker                                                                                                   0.5s
 => [builder 2/9] COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml                                                                     0.0s
 => [builder 3/9] COPY --from=pruner /app/out/json/ .                                                                                             0.0s 
 => [builder 4/9] RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --filter app-a                                 2.8s 
 => [builder 5/9] COPY --from=pruner /app/out/full/ .                                                                                             0.0s 
 => ERROR [builder 6/9] RUN turbo run db:generate                                                                                                 0.4s 
------                                                                                                                                                 
 > [builder 6/9] RUN turbo run db:generate:                                                                                                            
#18 0.325                                                                                                                                              
#18 0.325 Attention:                                                                                                                                   
#18 0.325 Turborepo now collects completely anonymous telemetry regarding usage.
#18 0.325 This information is used to shape the Turborepo roadmap and prioritize features.
#18 0.325 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
#18 0.325 https://turbo.build/repo/docs/telemetry
#18 0.325 
#18 0.352   x missing tasks in project
#18 0.352 
#18 0.352 Error:   x could not find task `db:generate` in project
#18 0.352 
------

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

Closing in favor of #8309 as this is almost definitely the same issue and it hasn't gotten any updates. See that issue for updates

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