Production build fails for nextjs client
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- nextjs, react, typescript
- Área
- build-system, frontend, web-dev
Línea de trabajo
Reproduce el fallo con compose.yaml y compose.prod.yaml usando los comandos de Docker y pnpm indicados; después, inspecciona las páginas de greetings de Next.js generadas y la configuración que proporciona su URL de API. Se considera completado cuando la compilación de production compose termina sin el error de URL undefined/greetings y las rutas de greetings se pueden servir.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 376
- Forks
- 132
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de api-platform/create-client
-
[potential Security Alert] New `test-vue-app` script added in `@api-platform/client-generator@0.8.0` Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
api-platform/create-client#396 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
api-platform/create-client#397 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
api-platform/create-client#395 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
api-platform/create-client#394 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
api-platform/create-client#393 · 1 comentario ·
Todos los issues de api-platform/create-client
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
mksglu/context-mode#1200 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
anthropics/claude-code#96687 ·
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
AOSSIE-Org/DebateAI#582 · 2 comentarios ·