47chapters / letsgo

Starter Kit for Starting Startups
MIT License
58 stars 10 forks source link

`yarn buildx` command failing #16

Open SkyHacks opened 10 months ago

SkyHacks commented 10 months ago

I followed the "First deployment To AWS" documentation and failed to successfully execute the yarn buildx command after several attempts.

I was eventually able to workaround the issue by changing apps/web/Dockerfile:26 from: RUN yarn install to: RUN yarn install --network-timeout 100000 The workaround comes from this issue on the yarn repo and feels like a hack to me but I really don't have the context to say for sure.

Here is the error message:

...
worker:buildx: #14 186.9 [5/5] Building fresh packages...
worker:buildx: #14 189.5 Done in 187.17s.
worker:buildx: #14 DONE 189.8s
worker:buildx: 
worker:buildx: #15 [installer 7/9] COPY --from=builder /app/out/full/ .
worker:buildx: #15 DONE 0.3s
worker:buildx: 
worker:buildx: #16 [installer 8/9] COPY turbo.json turbo.json
worker:buildx: #16 DONE 0.0s
worker:buildx: 
worker:buildx: #17 [installer 9/9] RUN yarn turbo run build --filter=worker...
worker:buildx: #17 2.216 yarn run v1.21.1
worker:buildx: #17 2.527 $ /app/node_modules/.bin/turbo run build --filter=worker...
worker:buildx: #17 4.695 • Packages in scope: @letsgo/constants, @letsgo/db, @letsgo/pricing, @letsgo/queue, @letsgo/slack, @letsgo/stripe, @letsgo/tenant, @letsgo/trust, @letsgo/types, eslint-config-custom, eslint-config-custom-server, jest-presets, tsconfig, worker
worker:buildx: #17 4.695 • Running build in 14 packages
worker:buildx: #17 4.695 • Remote caching disabled
worker:buildx: #17 4.714 @letsgo/constants:build: cache miss, executing 9b93190578ac4372
worker:buildx: #17 4.717 @letsgo/pricing:build: cache miss, executing 07c2dc6d360d65b7
worker:buildx: #17 4.717 @letsgo/slack:build: cache miss, executing 134cceea66c719e4
api:buildx: #22 27.09 @letsgo/stripe:build: cache miss, executing ad7c71dc3fc914a2
api:buildx: #22 27.09 @letsgo/db:build: cache miss, executing 9922cd9f185206ac
worker:buildx: #17 7.099 @letsgo/slack:build: $ tsc
worker:buildx: #17 7.137 @letsgo/pricing:build: $ tsc
worker:buildx: #17 7.225 @letsgo/constants:build: $ tsc
api:buildx: #22 29.28 @letsgo/stripe:build: $ tsc
api:buildx: #22 29.28 @letsgo/db:build: $ tsc
web:buildx: #18 192.4 info There appears to be trouble with your network connection. Retrying...
web:buildx: #18 202.5 info There appears to be trouble with your network connection. Retrying...
worker:buildx: #17 31.44 @letsgo/db:build: cache miss, executing 9922cd9f185206ac
worker:buildx: #17 31.45 @letsgo/stripe:build: cache miss, executing ad7c71dc3fc914a2
worker:buildx: #17 33.88 @letsgo/db:build: $ tsc
worker:buildx: #17 33.89 @letsgo/stripe:build: $ tsc
api:buildx: #22 57.83 @letsgo/trust:build: cache miss, executing b856ba60f390c46e
api:buildx: #22 60.09 @letsgo/trust:build: $ tsc
web:buildx: #18 228.7 error An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz: ESOCKETTIMEDOUT".
web:buildx: #18 228.8 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
web:buildx: #18 228.8 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
worker:buildx: #17 57.66 @letsgo/trust:build: cache miss, executing b856ba60f390c46e
worker:buildx: #17 60.00 @letsgo/trust:build: $ tsc
api:buildx: #22 81.90 @letsgo/tenant:build: cache miss, executing bcc6b3a2bc6a6e0a
api:buildx: #22 84.13 @letsgo/tenant:build: $ tsc
worker:buildx: #17 80.26 @letsgo/tenant:build: cache miss, executing bcc6b3a2bc6a6e0a
worker:buildx: #17 82.36 @letsgo/tenant:build: $ tsc
web:buildx: #18 ERROR: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1
web:buildx: ------
web:buildx:  > [installer  7/10] RUN yarn install:
web:buildx: 92.11 info There appears to be trouble with your network connection. Retrying...
web:buildx: 125.4 info There appears to be trouble with your network connection. Retrying...
web:buildx: 135.1 info There appears to be trouble with your network connection. Retrying...
web:buildx: 158.7 info There appears to be trouble with your network connection. Retrying...
web:buildx: 168.7 info There appears to be trouble with your network connection. Retrying...
web:buildx: 192.4 info There appears to be trouble with your network connection. Retrying...
web:buildx: 202.5 info There appears to be trouble with your network connection. Retrying...
web:buildx: 228.7 error An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz: ESOCKETTIMEDOUT".
web:buildx: 228.8 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
web:buildx: 228.8 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
web:buildx: ------
web:buildx: WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree
web:buildx: Dockerfile:26
web:buildx: --------------------
web:buildx:   24 |     COPY --from=builder /app/out/json/ .
web:buildx:   25 |     COPY --from=builder /app/out/yarn.lock ./yarn.lock
web:buildx:   26 | >>> RUN yarn install
web:buildx:   27 |     
web:buildx:   28 |     # Build the project
web:buildx: --------------------
web:buildx: ERROR: failed to solve: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1
web:buildx: error Command failed with exit code 1.
web:buildx: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web:buildx: ERROR: command finished with error: command (/Users/sky/Dev/letsgo/apps/web) yarn run buildx exited (1)
worker:buildx: #17 CANCELED
worker:buildx: WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree
worker:buildx: ERROR: failed to solve: Canceled: context canceled
api:buildx: #22 CANCELED
api:buildx: WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree
api:buildx: ERROR: failed to solve: Canceled: context canceled
web#buildx: command (/Users/sky/Dev/letsgo/apps/web) yarn run buildx exited (1)

 Tasks:    13 successful, 16 total
Cached:    13 cached, 16 total
  Time:    5m2.375s 
Failed:    web#buildx

 ERROR  run failed: command  exited (1)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
SkyHacks commented 10 months ago

I'm confident my internet connection was stable and available during the attempts. It always failed at the same point with the same error message.

tjanczuk commented 10 months ago

Hi @SkyHacks, how are things with you?

What is your environment? (Hardware, OS, yarn version)?

If you remove your node_modules and run yarn install from the top of the repo, do you also run into this problem?

SkyHacks commented 9 months ago

Hi @tjanczuk, I'm doing great! Thanks for making this, it's super cool.

My environment is 2021 MacBook Pro, Apple M1 Pro chip, 16GB RAM, macOS Sonoma 14.2.1, yarn version 1.22.4.

Just tried removing node_modules and yarn install ran fine. No issues there.