turborepo fails to build

Hello,

I"m using the fly github action to deploy my app:

  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    needs: [test]
    steps:
      - uses: actions/checkout@v4
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: npm run deploy:frontend
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

with a basic dockerfile:

FROM node:22-alpine AS base

FROM base AS builder

# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN npm i turbo -g
COPY . .
RUN turbo prune admin --docker

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app

# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/package-lock.json ./package-lock.json

RUN npm install turbo -g
RUN npm install

# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json


RUN turbo run build --filter=admin...

FROM base AS runner
WORKDIR /app

# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs

COPY --from=installer /app/apps/admin/next.config.ts .
COPY --from=installer /app/apps/admin/package.json .

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/admin/.next/standalone ./

# Copy app static files
COPY --from=installer --chown=nextjs:nodejs /app/apps/admin/.next/static ./apps/admin/.next/static

# Copy app translations
COPY --from=installer --chown=nextjs:nodejs /app/apps/admin/public ./apps/admin/public

# Copy ui-library translations
COPY --from=installer --chown=nextjs:nodejs /app/packages/ui-components/public ./packages/ui-components/public

CMD node apps/admin/server.js

for some reason I get a typescript error that doesn’t make sense:

Type error: Parameter 'item' implicitly has an 'any' type.

I can build the app locally without any problem, I can create the docker image locally without any problem, I can even deploy from my local machine using

flyctl deploy --dockerfile ./apps/admin/Dockerfile --config ./apps/admin/fly.toml

and it all works fine, why the ci doesn’t work?

What RUN step fails? Use GitHub - nektos/act: Run your GitHub Actions locally 🚀 to run your actions locally to make sure you’re not missing anything on GHA.

it fails the deployment:

Run npm run deploy:frontend
> deploy:frontend
> flyctl deploy --dockerfile ./apps/admin/Dockerfile --config ./apps/admin/fly.toml --debug --verbose

I mean in the Dockerfile, not the GHA

this is when I build nextjs:

RUN turbo run build --filter=admin...

this is the output:

#19 [installer 11/11] RUN turbo run build --filter=admin...
#19 0.176 
#19 0.176 turbo 2.4.4
#19 0.176 
#19 0.254 • Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui-components, admin
#19 0.254 • Running build in 4 packages
#19 0.254 • Remote caching disabled
#19 0.355 admin:build: cache miss, executing 06543402a1908c01
#19 0.754 admin:build: 
#19 0.754 admin:build: > admin@0.1.0 build
#19 0.754 admin:build: > next build
#19 0.754 admin:build: 
#19 2.381 admin:build:    ▲ Next.js 15.2.3
#19 2.387 admin:build:    Linting and checking validity of types ...
#19 14.49 admin:build: 
#19 14.49 admin:build: ./src/container/Frontend/Summary.tsx
#19 14.49 admin:build: 23:18  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
#19 14.49 admin:build: 
#19 14.49 admin:build: info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/app/api-reference/config/eslint#disabling-rules
#19 33.69 admin:build: Failed to compile.
#19 33.69 admin:build: 
#19 33.72 admin:build: ../../packages/ui-components/src/components/Form/Autocomplete/Autocomplete.tsx:64:28
#19 33.72 admin:build: Type error: Parameter 'item' implicitly has an 'any' type.
#19 33.72 admin:build: 
#19 33.72 admin:build:   62 |               }
#19 33.72 admin:build:   63 |             : {
#19 33.72 admin:build: > 64 |                 onChange: (item) => onChange(item?.value ?? null),
#19 33.72 admin:build:      |                            ^
#19 33.72 admin:build:   65 |               })}
#19 33.72 admin:build:   66 |         />
#19 33.72 admin:build:   67 |       )}
#19 33.96 admin:build: Next.js build worker exited with code: 1 and signal: null
#19 34.00 admin:build: npm error Lifecycle script `build` failed with error:

where onchange is:

export type AutoCompleteFieldProps<T extends AutoCompleteOption> = {
  ...
  } & (
      | {
          isMultiple: true;
          onChange: (value: T[]) => void;
        }
      | {
          isMultiple?: never;
          onChange: (value: T | null) => void;
        }
    );

but I can’t see this error when building locally, vscode doesn’t throw this error, it fails only when building the app using the builder machine

Try copying the tsconfig.json file before you build.

the upper/lowercase hit again :man_facepalming:

for some reason I had a component lowercase but shown as uppercase in vscode, yet I’m not sure why locally it worked…anyway thanks for the support!

Linux is case sensitive and macos isn’t.

1 Like