Problem with compiling nextjs and running in docker
Unanswered
Dwarf Crocodile posted this in #help-forum
Dwarf CrocodileOP
Here is my docker file
and when i try to build it i get this error
even though when i run pnpm build locally it works without error
FROM node:18.17.0-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN SKIP_ENV_VALIDATION=1 npm run build
FROM node:18.17.0-alpine AS runner
WORKDIR /app
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next ./.next
RUN npm install --production
EXPOSE 3000
CMD ["npm", "start"]and when i try to build it i get this error
26.03 Error: A "use server" file can only export async functions. Found "C" that is not an async function.
26.03 Read more: https://nextjs.org/docs/messages/invalid-use-server-value
26.03 at r (/app/.next/server/app/(user)/[...pageHref]/page.js:2:136)
26.03 at 9484 (/app/.next/server/app/(user)/[...pageHref]/page.js:3:39859)
26.03 at t (/app/.next/server/webpack-runtime.js:1:128)
26.03 at 5446 (/app/.next/server/app/(user)/[...pageHref]/page.js:3:36734)
26.03 at Function.t (/app/.next/server/webpack-runtime.js:1:128)
26.03 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
26.03 at async collectGenerateParams (/app/node_modules/next/dist/build/utils.js:919:21)
26.03 at async /app/node_modules/next/dist/build/utils.js:1138:17
26.03 at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:151:20)
26.04
26.04 > Build error occurred
26.04 Error: Failed to collect page data for /[...pageHref]
26.04 at /app/node_modules/next/dist/build/utils.js:1258:15
26.04 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
26.04 type: 'Error'
26.04 }even though when i run pnpm build locally it works without error
1 Reply
Narrow-barred Spanish mackerel
Without seeing the function it's hard to say but check here : https://github.com/vercel/next.js/issues/62926