forbole / big-dipper-2.0-cosmos

https://bigdipper.live
Apache License 2.0
142 stars 337 forks source link

Docker image is not buildable #670

Closed berelton closed 2 years ago

berelton commented 2 years ago

Code source: tags/base-v1.9.0

Step 23/25 : RUN npm run build
 ---> Running in 21f153dd9352
> big-dipper-2.0-cosmos@1.0.0 build /app
> npm run build:next && npm run build:server
> big-dipper-2.0-cosmos@1.0.0 build:next /app
> next build
info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
info  - Checking validity of types...
warn  - The Next.js plugin was not detected in your ESLint configuration. See https://nextjs.org/docs/basic-features/eslint#migrating-existing-config
info  - Creating an optimized production build...
info  - Using external babel configuration from /app/.babelrc
🚨 [next-translate] In Next 10.x.x there is an issue related to i18n and getInitialProps. We recommend to replace getInitialProps to getServerSideProps on /_error.tsx. Issue: https://github.com/vercel/next.js/issues/18396
[BABEL] Note: The code generator has deoptimised the styling of /app/src/graphql/types.tsx as it exceeds the max of 500KB.
🚨 [next-translate] In Next 10.x.x there is an issue related to i18n and getInitialProps. We recommend to replace getInitialProps to getServerSideProps on /_error.tsx. Issue: https://github.com/vercel/next.js/issues/18396
[BABEL] Note: The code generator has deoptimised the styling of /app/src/graphql/types.tsx as it exceeds the max of 500KB.
info  - Compiled successfully
info  - Collecting page data...
(node:29) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_URL]: Invalid URL: 
    at onParseError (internal/url.js:256:9)
    at new URL (internal/url.js:332:5)
    at initAsClient (/app/node_modules/ws/lib/websocket.js:611:17)
    at new WebSocket (/app/node_modules/ws/lib/websocket.js:71:7)
    at SubscriptionClient.connect (/app/node_modules/subscriptions-transport-ws/dist/client.js:446:23)
    at new SubscriptionClient (/app/node_modules/subscriptions-transport-ws/dist/client.js:99:18)
    at new WebSocketLink (/app/node_modules/@apollo/client/link/ws/ws.cjs.js:17:40)
    at Object.8039 (/app/.next/server/pages/_app.js:73:16)
    at __webpack_require__ (/app/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/app/.next/server/pages/_app.js:1108:39)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:29) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:29) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:29) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_URL]: Invalid URL: 
    at onParseError (internal/url.js:256:9)
    at new URL (internal/url.js:332:5)
    at initAsClient (/app/node_modules/ws/lib/websocket.js:611:17)
    at new WebSocket (/app/node_modules/ws/lib/websocket.js:71:7)
    at SubscriptionClient.connect (/app/node_modules/subscriptions-transport-ws/dist/client.js:446:23)
    at new SubscriptionClient (/app/node_modules/subscriptions-transport-ws/dist/client.js:99:18)
    at new WebSocketLink (/app/node_modules/@apollo/client/link/ws/ws.cjs.js:17:40)
    at Object.8039 (/app/.next/server/pages/_app.js:73:16)
    at __webpack_require__ (/app/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/app/.next/server/pages/_app.js:1108:39)
(node:29) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
> Build error occurred
TypeError [ERR_INVALID_URL]: Invalid URL: 
    at onParseError (internal/url.js:256:9)
    at new URL (internal/url.js:332:5)
    at initAsClient (/app/node_modules/ws/lib/websocket.js:611:17)
    at new WebSocket (/app/node_modules/ws/lib/websocket.js:71:7)
    at SubscriptionClient.connect (/app/node_modules/subscriptions-transport-ws/dist/client.js:446:23)
    at new SubscriptionClient (/app/node_modules/subscriptions-transport-ws/dist/client.js:99:18)
    at new WebSocketLink (/app/node_modules/@apollo/client/link/ws/ws.cjs.js:17:40)
    at Object.8039 (/app/.next/server/pages/_app.js:73:16)
    at __webpack_require__ (/app/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/app/.next/server/pages/_app.js:1108:39) {
  type: 'NodeError',
  input: '',
  code: 'ERR_INVALID_URL'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! big-dipper-2.0-cosmos@1.0.0 build:next: `next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the big-dipper-2.0-cosmos@1.0.0 build:next script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-18T19_12_04_687Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! big-dipper-2.0-cosmos@1.0.0 build: `npm run build:next && npm run build:server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the big-dipper-2.0-cosmos@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-18T19_12_04_701Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1
ryuash commented 2 years ago

What's the command you used to build the image?

The only time I could reproduce this error is if no arguments are passed during the build, or if the arguments were not correct (in this case, the url).

https://docs.docker.com/engine/reference/builder/#arg

randygrok commented 2 years ago

Is there any example on how to build the image with the arguments? This means that the image is built with hardcoded values related to the chain instead of passing them dynamically?

Thanks!

ryuash commented 2 years ago

@randygrok in the root of the folder:

docker build \
--build-arg NEXT_PUBLIC_GRAPHQL_URL="https://gql.mainnet.desmos.network/v1/graphql" \
--build-arg NEXT_PUBLIC_GRAPHQL_WS="wss://gql-ws.mainnet.desmos.network/v1/graphql" \
--build-arg NEXT_PUBLIC_URL="https://explorer.desmos.network" \
--build-arg NEXT_PUBLIC_WS_CHAIN_URL="wss://rpc.mainnet.desmos.network/websocket" \
--build-arg NEXT_PUBLIC_CHAIN_STATUS="mainnet" \
--build-arg NODE_ENV="production" \
--build-arg PORT=3000 \
-t build-example .

This means that the image is built with hardcoded values related to the chain instead of passing them dynamically?

Yes, since the image is for production build purposes. If you need to test anything you should run it locally in dev mode first