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

Docker Build 'Args' does not satisfy the constraint 'PageProps' #8780

Closed
ArcaneTSGK opened this issue Oct 18, 2024 · 3 comments
Closed

Docker Build 'Args' does not satisfy the constraint 'PageProps' #8780

ArcaneTSGK opened this issue Oct 18, 2024 · 3 comments
Labels

Comments

@ArcaneTSGK
Copy link

ArcaneTSGK commented Oct 18, 2024

Describe the Bug

When running the docker build . command with a version of payload > beta.110 the build fails at the pnpm run build step with the following error:

 => ERROR [builder 4/4] RUN   if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build;   else echo "Lockfile not found." && exit 1;   fi                                                45.4s 
------
 > [builder 4/4] RUN   if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build;   else echo "Lockfile not found." && exit 1;   fi:
0.561 ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-9.8.0.tgz
2.270
2.270 > [email protected] build /app
2.270 > cross-env NODE_OPTIONS=--no-deprecation next build
2.270
2.890   ▲ Next.js 15.0.0-canary.173
2.890   - Experiments (use with caution):
2.890     · turbo
2.890
2.904    Creating an optimized production build ...
40.51  ✓ Compiled successfully
40.52    Linting and checking validity of types ...
45.00 Failed to compile.
45.00
45.01 src/app/(payload)/admin/[[...segments]]/page.tsx
45.01 Type error: Type 'Args' does not satisfy the constraint 'PageProps'.
45.01   Types of property 'params' are incompatible.
45.01     Type '{ segments: string[]; }' is missing the following properties from type 'Promise<any>': then, catch, finally, [Symbol.toStringTag]
45.01
45.12  ELIFECYCLE  Command failed with exit code 1.
------

I tried to create a minimal repro of the issue with the command below, but that also results in an error

$ npx create-payload-app@beta -t blank
npm warn exec The following package was not found and will be installed: [email protected]


T   create-payload-app
|
o   --------------------------------------------+
|                                               |
|  Welcome to Payload. Let's create a project!  |
|                                               |
+-----------------------------------------------+
|
x  TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)

Link to the code that reproduces this issue

https://github.com/ArcaneTSGK/payload-docker-repro

Reproduction Steps

Install the packages in the environment info provided, namely any beta version of payload packages > beta.110

Run docker build . with the following dockerfile

# From https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile

FROM node:20-alpine AS base

FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json pnpm-lock.yaml* ./
RUN \
  if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
  else echo "Lockfile not found." && exit 1; \
  fi

FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1

RUN \
  if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
  else echo "Lockfile not found." && exit 1; \
  fi

FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

RUN mkdir .next
RUN chown nextjs:nodejs .next

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD HOSTNAME="0.0.0.0" node server.js

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
Node: 20.17.0
pnpm: 9.8.0
Relevant Packages:
payload: 3.0.0-beta.111
next: 15.0.0-canary.173
@payloadcms/db-postgres: 3.0.0-beta.111
@payloadcms/email-nodemailer: 3.0.0-beta.111
@payloadcms/graphql: 3.0.0-beta.111
@payloadcms/next/utilities: 3.0.0-beta.111
@payloadcms/plugin-cloud: 3.0.0-beta.111
@payloadcms/plugin-cloud-storage: 3.0.0-beta.111
@payloadcms/richtext-lexical: 3.0.0-beta.111
@payloadcms/storage-s3: 3.0.0-beta.111
@payloadcms/translations: 3.0.0-beta.111
@payloadcms/ui/shared: 3.0.0-beta.111
react: 19.0.0-rc-77b637d6-20241016
react-dom: 19.0.0-rc-77b637d6-20241016
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 32453
Available CPU cores: 16

@ArcaneTSGK ArcaneTSGK added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Oct 18, 2024
@ArcaneTSGK
Copy link
Author

I managed to get it working by replacing the /app directory with the output of the npx command in my existing project.

There must be some incompatibility with the /page.tsx that is autogenerated between beta.110 and >= beta.111 that either isn't in the release notes or is there and I missed note of them.

@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 18, 2024
@smoothdvd
Copy link

You should replace src/app/(payload)/admin/[[...segments]]/page.tsx and not_found.tsx with the latest version from the beta branch. Directly upgrading package dependencies did not update the App Router pages.

This issue occurs because Next.js’s params are now Promises.

https://nextjs.org/docs/canary/app/api-reference/file-conventions/page

Copy link

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants