Production build fails for nextjs client
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- nextjs, react, typescript
- Lĩnh vực
- build-system, frontend, web-dev
Hướng nghiên cứu
Tái hiện lỗi với compose.yaml và compose.prod.yaml bằng các lệnh Docker và pnpm được liệt kê, sau đó kiểm tra các trang greetings do Next.js tạo ra và cấu hình cung cấp API URL cho chúng. Được xem là hoàn tất khi production compose build hoàn thành mà không có lỗi URL undefined/greetings và các route greetings có thể được phục vụ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
API Platform version(s) affected: 3.2.16
Description
With a fresh installation, I was able to run the generator for the default Greeting entity. The app works in dev mode. When I try to build the app in production mode with http only, it fails with the following message:
9.052 Creating an optimized production build ...
38.73 ✓ Compiled successfully
38.73 Collecting page data ...
39.13 TypeError: Failed to parse URL from undefined/greetings
39.13 at node:internal/deps/undici/undici:12345:11
39.13 at async c (/srv/app/.next/server/pages/greetings/page/[page].js:1:7873)
39.13 at async c (/srv/app/.next/server/pages/greetings/page/[page].js:1:7119)
39.13 at async buildStaticPaths (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:786:33)
39.13 at async /srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1215:110
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:151:20) {
39.13 [cause]: TypeError: Invalid URL
39.13 at new URL (node:internal/url:775:36)
39.13 at new Request (node:internal/deps/undici/undici:5853:25)
39.13 at fetch (node:internal/deps/undici/undici:10123:25)
39.13 at Object.fetch (node:internal/deps/undici/undici:12344:10)
39.13 at fetch (node:internal/process/pre_execution:336:27)
39.13 at c (/srv/app/.next/server/pages/greetings/page/[page].js:1:7892)
39.13 at c (/srv/app/.next/server/pages/greetings/page/[page].js:1:7133)
39.13 at buildStaticPaths (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:786:39)
39.13 at /srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1215:116
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:151:20) {
39.13 code: 'ERR_INVALID_URL',
39.13 input: 'undefined/greetings'
39.13 }
39.13 }
39.13 TypeError: Failed to parse URL from undefined/greetings
39.13 at node:internal/deps/undici/undici:12345:11
39.13 at async o (/srv/app/.next/server/pages/greetings/[id].js:1:5312)
39.13 at async y (/srv/app/.next/server/pages/greetings/[id].js:1:4222)
39.13 at async buildStaticPaths (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:786:33)
39.13 at async /srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1215:110
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:151:20) {
39.13 [cause]: TypeError: Invalid URL
39.13 at new URL (node:internal/url:775:36)
39.13 at new Request (node:internal/deps/undici/undici:5853:25)
39.13 at fetch (node:internal/deps/undici/undici:10123:25)
39.13 at Object.fetch (node:internal/deps/undici/undici:12344:10)
39.13 at fetch (node:internal/process/pre_execution:336:27)
39.13 at o (/srv/app/.next/server/pages/greetings/[id].js:1:5331)
39.13 at y (/srv/app/.next/server/pages/greetings/[id].js:1:4236)
39.13 at buildStaticPaths (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:786:39)
39.13 at /srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1215:116
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:151:20) {
39.13 code: 'ERR_INVALID_URL',
39.13 input: 'undefined/greetings'
39.13 }
39.13 }
39.13
39.13 > Build error occurred
39.13 Error: Failed to collect page data for /greetings/page/[page]
39.13 at /srv/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/build/utils.js:1258:15 {
39.13 type: 'Error'
39.13 }
39.15 ELIFECYCLE Command failed with exit code 1.
------
failed to solve: process "/bin/sh -c pnpm install --frozen-lockfile --offline --prod && \tpnpm run build" did not complete successfully: exit code: 1
How to reproduce
- Download the 3.2.16 distribution
- docker compose build --no-cache
- docker compose up --wait
- docker compose exec pwa pnpm create @api-platform/client --resource greeting -g next
- go to localhost/greetings to verify that the greetings page works
- docker compose down
- SERVER_NAME=:80 APP_SECRET=ChangeMe CADDY_MERCURE_JWT_SECRET=ChangeThisMercureHubJWTSecretKey docker compose -f compose.yaml -f compose.prod.yaml up --build
- TypeError: Failed to parse URL from undefined/greetings
- Ngôn ngữ chính
- TypeScript
- Star
- 376
- Fork
- 132
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của api-platform/create-client
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#396 ·
-
[potential Security Alert] New `test-nuxt-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
api-platform/create-client#397 ·
-
[potential Security Alert] New `test-next-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
api-platform/create-client#395 ·
-
[potential Security Alert] New `test-react-app` script added in `@api-platform/[email protected]`Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
api-platform/create-client#394 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
api-platform/create-client#393 · 1 bình luận ·
Tất cả issue của api-platform/create-client
Issue tương tự
-
Dependencies view: `getParent` loops forever on untitled documents, extension host runs out of memoryCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
awslabs/visual-asset-management-system#413 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug confirmed perf
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
videojs/video.js#9400 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug pending triage scope/agent
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue hacktoberfest
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
HelpCode-ai/anythingmcp#996 ·
Maintainer thường phản hồi trong vòng 1 ngày