Production build fails for nextjs client
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- nextjs, react, typescript
- 領域
- build-system, frontend, web-dev
調査の方向性
一覧にある Docker と pnpm のコマンドを使って compose.yaml と compose.prod.yaml で失敗を再現し、生成された Next.js の greetings ページと、それらの API URL を提供する設定を調査します。production compose のビルドが undefined/greetings URL エラーなしで完了し、greetings ルートを提供できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:786:33)
39.13 at async /srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1215:110
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/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/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:786:39)
39.13 at /srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1215:116
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/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/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:786:33)
39.13 at async /srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1215:110
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/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/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:786:39)
39.13 at /srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1215:116
39.13 at async Span.traceAsyncFn (/srv/app/node_modules/.pnpm/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/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/next@14.1.2_@babel+core@7.24.0_react-dom@18.2.0_react@18.2.0/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
- 主要言語
- TypeScript
- スター
- 376
- フォーク
- 132
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
api-platform/create-client のほかの issue
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/client-generator@0.8.0` オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
api-platform/create-client#396 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
api-platform/create-client#397 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
api-platform/create-client#395 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
api-platform/create-client#394 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
api-platform/create-client#393 · コメント 1 件 ·
api-platform/create-client の issue をすべて見る
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100