aws-samples / aws-serverless-ai-stories

Example open source event-driven application that generates a new bed time story for your children every night using Lambda, EventBridge, DynamoDB, App Runner, ChatGPT and DALL-E.
https://aws-blogs-prod.amazon.com/compute/implementing-an-event-driven-serverless-story-generation-application-with-chatgpt-and-dall-e/
MIT No Attribution
151 stars 48 forks source link

cannot run npm run deploy #6

Open WebbTseng opened 1 year ago

WebbTseng commented 1 year ago

executor failed running [/bin/sh -c npm run build]: exit code: 1 [100%] fail: docker build --tag cdkasset-eac8aa482c5b0aaf9cf45dca81711c0e905f42cb36626f8893814cdde62907a0 --platform linux/amd64 . exited with error code 1: #1 [internal] load build definition from Dockerfile

1 sha256:94ad57c069987cc5f2545ee37b0f671e5b0cc64f5b79f45035c90208c26c311d

1 transferring dockerfile: 37B done

1 DONE 0.0s

{A[Y].splice(0,A[v]npm ERR! code ELIFECYCLE

14 0.836 npm ERR! errno 1

14 0.839 npm ERR! @ build: next build

14 0.839 npm ERR! Exit status 1

14 0.839 npm ERR!

14 0.840 npm ERR! Failed at the @ build script.

14 0.840 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

14 0.844

14 0.844 npm ERR! A complete log of this run can be found in:

14 0.844 npm ERR! /root/.npm/_logs/2023-05-19T21_05_51_228Z-debug.log

14 ERROR: executor failed running [/bin/sh -c npm run build]: exit code: 1


[builder 5/5] RUN npm run build:

executor failed running [/bin/sh -c npm run build]: exit code: 1 stg-aiStoriesBackend: building assets...

[0%] start: Building b4dc6bab39417a56a230ec51c4b77694c3b7e2b741828a002aac1ca2bc339ebb:current_account-current_region [0%] start: Building 4aea577eb744c3399c23dd93a5ab40e0b5a9bb67b0a65cd383ca9c1b728b6e1b:current_account-current_region [0%] start: Building 369141d9c3fce053bfb036a3081d5b6ac09d809d33f4e7705d3bb95f4708fe08:current_account-current_region [0%] start: Building 61c63449bfa374126c263ef985e327bb569ab247e7e1537d0542c77b2e18ab0d:current_account-current_region [25%] success: Built b4dc6bab39417a56a230ec51c4b77694c3b7e2b741828a002aac1ca2bc339ebb:current_account-current_region [50%] success: Built 4aea577eb744c3399c23dd93a5ab40e0b5a9bb67b0a65cd383ca9c1b728b6e1b:current_account-current_region [75%] success: Built 369141d9c3fce053bfb036a3081d5b6ac09d809d33f4e7705d3bb95f4708fe08:current_account-current_region [100%] success: Built 61c63449bfa374126c263ef985e327bb569ab247e7e1537d0542c77b2e18ab0d:current_account-current_region

stg-aiStoriesBackend: assets built

❌ Building assets failed: Error: Building Assets Failed: Error: Failed to build one or more assets. See the error messages above for more information. at buildAllStackAssets (/Users/chiweitseng/WorkSpace/gluten-ai/aws-serverless-ai-stories/backend/node_modules/aws-cdk/lib/index.js:347:116743) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async CdkToolkit.deploy (/Users/chiweitseng/WorkSpace/gluten-ai/aws-serverless-ai-stories/backend/node_modules/aws-cdk/lib/index.js:347:142824) at async exec4 (/Users/chiweitseng/WorkSpace/gluten-ai/aws-serverless-ai-stories/backend/node_modules/aws-cdk/lib/index.js:402:51795)

Building Assets Failed: Error: Failed to build one or more assets. See the error messages above for more information.

WebbTseng commented 1 year ago

14 0.826 uncaughtException /app/node_modules/next/dist/compiled/undici/index.js:1

davidwintermeyer commented 1 year ago

Having a similar issue. @WebbTseng any luck?

boyney123 commented 1 year ago

Hey,

@davidwintermeyer you finding the same when you run the build command? What OS are you using?

davidwintermeyer commented 1 year ago

This was running npm run deploy

Screenshot 2023-06-12 at 1 39 58 PM

I looked at the stack hierarchy and tried to deploy individually. I was able to successfully deploy stg-aiStoriesTables.

When I try to deploy stg-webStack I get the following error:

Screenshot 2023-06-12 at 1 42 14 PM

I looked in CW logs of the Service being deployed and get this error [AppRunner] Deployment with ID : 69b1ddc9f98d41908af5517bf89e8138 failed. Failure reason : Failed to copy the image from ECR.

I tried to push an image to ECR myself. This is my ECR

Screenshot 2023-06-12 at 1 44 59 PM

My guess is that an issue with the assets is causing the image to not be pushed to ECR, which is why the stg-webStack is failing to deploy. I'm not sure how to debug this though - I'm not great with docker. Thanks for your help!

mchugh7153 commented 1 year ago

Was this issue ever resolved? @boyney123, @mmuller88

calsaviour commented 1 year ago

Update the Dockerfile to use. node:19-alpine

My guess is the next latest version was not compatible with node:14-apline.

And it works.

image

khaneun commented 8 months ago

Thanks for solving my same problem

Dockerfile Location for modification ~/aws-serverless-ai-stories/frontend/Dockerfile 2,10,17 line