aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
176 stars 61 forks source link

Build timed out #1942

Closed krtallc closed 1 month ago

krtallc commented 2 months ago

Environment information

npx ampx info

Describe the bug

Build

More than 1 hour Build timed out

Here is the amplify.yml:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - chmod +x build.sh
        - ./build.sh
    build:
      commands:
        - streamlit run streamlit_app.py
  artifacts:
    baseDirectory: /
    files:
      - "**/*"
#  cache:
#    paths:
#      - node_modules/**/*
#      - "!node_modules/path/not/to/cache"
  backend:
    phases:
      build:
        commands:
          - "#Execute Amplify CLI with helper script"
#          - envCache --set stackinfo""
          - amplifyPush --simple

Here is deploy log:

2024-08-31T15:34:05.374Z [INFO]: # Cloning repository: git@github.com:krtallc/krtallc.git

1

2024-08-31T15:34:10.026Z [INFO]:

2

2024-08-31T15:34:10.099Z [INFO]: Cloning into 'krtallc'...

3

Updating files: 85% (6661/7817) Updating files: 86% (6723/7817) Updating files: 87% (6801/7817) Updating files: 88% (6879/7817) Updating files: 89% (6958/7817) Updating files: 90% (7036/7817) Updating files: 91% (7114/7817) Updating files: 92% (7192/7817) Updating files: 93% (7270/7817) Updating files: 94% (7348/7817) Updating files: 95% (7427/7817) Updating files: 96% (7505/7817) Updating files: 97% (7583/7817) Updating files: 98% (7661/7817) Updating files: 99% (7739/7817) Updating files: 100% (7817/7817) Updating files: 100% (7817/7817), done.

4

2024-08-31T15:34:10.099Z [INFO]: # Checking for Git submodules at: /codebuild/output/src3522305196/src/krtallc/.gitmodules

5

2024-08-31T15:34:10.104Z [INFO]: # Retrieving environment cache...

6

2024-08-31T15:34:10.138Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}

7

2024-08-31T15:34:10.139Z [INFO]: ---- Setting Up SSM Secrets ----

8

2024-08-31T15:34:10.139Z [INFO]: SSM params {"Path":"/amplify/d2m72xckjf9w0p/main/","WithDecryption":true}

9

2024-08-31T15:34:10.177Z [WARNING]: !Failed to set up process.env.secrets

10

2024-08-31T15:34:11.120Z [INFO]: No live updates for this build run

11

2024-08-31T15:34:11.124Z [INFO]: # Retrieving cache...

12

2024-08-31T15:34:11.171Z [INFO]: # Retrieved cache

13

2024-08-31T15:34:15.007Z [INFO]: ## Starting Backend Build

14

## Checking for associated backend environment...

15

## No backend environment association found, continuing...

16

## Completed Backend Build

17

2024-08-31T15:34:15.012Z [INFO]: {"backendDuration": 0}

18

## Starting Frontend Build

19

# Starting phase: preBuild

20

# Executing command: chmod +x build.sh

21

# Executing command: ./build.sh

22

2024-08-31T15:34:31.228Z [INFO]: Collecting Streamlit==1.38.0

23

2024-08-31T15:34:31.283Z [INFO]: Downloading streamlit-1.38.0-py2.py3-none-any.whl (8.7 MB)

24

2024-08-31T15:34:31.612Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.7/8.7 MB 26.8 MB/s eta 0:00:00

25

2024-08-31T15:34:31.612Z [INFO]:

26

2024-08-31T15:34:32.313Z [INFO]: Collecting pymongo==4.8.0

27

2024-08-31T15:34:32.354Z [INFO]: Downloading pymongo-4.8.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)

28

2024-08-31T15:34:32.377Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 56.6 MB/s eta 0:00:00

29

2024-08-31T15:34:32.377Z [INFO]:

30

2024-08-31T15:34:32.415Z [INFO]: Collecting python-dotenv==1.0.0

31

2024-08-31T15:34:32.425Z [INFO]: Downloading python_dotenv-1.0.0-py3-none-any.whl (19 kB)

32

2024-08-31T15:34:32.483Z [INFO]: Collecting altair<6,>=4.0

33

2024-08-31T15:34:32.558Z [INFO]: Downloading altair-5.4.1-py3-none-any.whl (658 kB)

34

2024-08-31T15:34:32.573Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 658.1/658.1 kB 55.0 MB/s eta 0:00:00

35

2024-08-31T15:34:32.573Z [INFO]:

36

2024-08-31T15:34:32.971Z [INFO]: Collecting pillow<11,>=7.1.0

37

2024-08-31T15:34:32.982Z [INFO]: Downloading pillow-10.4.0-cp310-cp310-manylinux_2_28_x86_64.whl (4.5 MB)

38

2024-08-31T15:34:33.046Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 73.9 MB/s eta 0:00:00

39

2024-08-31T15:34:33.046Z [INFO]:

40

2024-08-31T15:34:33.195Z [INFO]: Collecting toml<2,>=0.10.1

41

2024-08-31T15:34:33.205Z [INFO]: Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)

42

2024-08-31T15:34:33.328Z [INFO]: Collecting gitpython!=3.1.19,<4,>=3.0.7

43

2024-08-31T15:34:33.339Z [INFO]: Downloading GitPython-3.1.43-py3-none-any.whl (207 kB)

44

2024-08-31T15:34:33.345Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 207.3/207.3 kB 59.4 MB/s eta 0:00:00

45

2024-08-31T15:34:33.345Z [INFO]:

46

2024-08-31T15:34:33.347Z [INFO]: Requirement already satisfied: rich<14,>=10.14.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (13.6.0)

47

2024-08-31T15:34:33.348Z [INFO]: Requirement already satisfied: packaging<25,>=20 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (23.2)

48

2024-08-31T15:34:33.464Z [INFO]: Collecting tornado<7,>=6.0.3

49

2024-08-31T15:34:33.474Z [INFO]: Downloading tornado-6.4.1-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436 kB)

50

2024-08-31T15:34:33.481Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 436.8/436.8 kB 87.4 MB/s eta 0:00:00

51

2024-08-31T15:34:33.481Z [INFO]:

52

2024-08-31T15:34:33.485Z [INFO]: Requirement already satisfied: watchdog<5,>=2.1.5 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (3.0.0)

53

2024-08-31T15:34:33.658Z [INFO]: Collecting pyarrow>=7.0

54

2024-08-31T15:34:33.667Z [INFO]: Downloading pyarrow-17.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (39.9 MB)

55

2024-08-31T15:34:34.002Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 39.9/39.9 MB 64.6 MB/s eta 0:00:00

56

2024-08-31T15:34:34.003Z [INFO]:

57

2024-08-31T15:34:34.378Z [INFO]: Collecting pandas<3,>=1.3.0

58

2024-08-31T15:34:34.389Z [INFO]: Downloading pandas-2.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB)

59

2024-08-31T15:34:34.495Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.0/13.0 MB 115.9 MB/s eta 0:00:00

60

2024-08-31T15:34:34.495Z [INFO]:

61

2024-08-31T15:34:34.540Z [INFO]: Requirement already satisfied: typing-extensions<5,>=4.3.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (4.8.0)

62

2024-08-31T15:34:34.576Z [INFO]: Collecting tenacity<9,>=8.1.0

63

2024-08-31T15:34:34.623Z [INFO]: Downloading tenacity-8.5.0-py3-none-any.whl (28 kB)

64

2024-08-31T15:34:34.627Z [INFO]: Requirement already satisfied: blinker<2,>=1.0.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (1.7.0)

65

2024-08-31T15:34:34.708Z [INFO]: Collecting pydeck<1,>=0.8.0b4

66

2024-08-31T15:34:34.758Z [INFO]: Downloading pydeck-0.9.1-py2.py3-none-any.whl (6.9 MB)

67

2024-08-31T15:34:34.813Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.9/6.9 MB 130.8 MB/s eta 0:00:00

68

2024-08-31T15:34:34.814Z [INFO]:

69

2024-08-31T15:34:35.252Z [INFO]: Collecting numpy<3,>=1.20

70

2024-08-31T15:34:35.262Z [INFO]: Downloading numpy-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.3 MB)

71

2024-08-31T15:34:35.389Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.3/16.3 MB 112.0 MB/s eta 0:00:00

72

2024-08-31T15:34:35.389Z [INFO]:

73

2024-08-31T15:34:35.438Z [INFO]: Requirement already satisfied: requests<3,>=2.27 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (2.31.0)

74

2024-08-31T15:34:35.439Z [INFO]: Requirement already satisfied: click<9,>=7.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from Streamlit==1.38.0->-r requirements.txt (line 2)) (8.1.7)

75

2024-08-31T15:34:35.863Z [INFO]: Collecting protobuf<6,>=3.20

76

2024-08-31T15:34:35.903Z [INFO]: Downloading protobuf-5.28.0-cp38-abi3-manylinux2014_x86_64.whl (316 kB)

77

2024-08-31T15:34:35.911Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 316.6/316.6 kB 55.0 MB/s eta 0:00:00

78

2024-08-31T15:34:35.911Z [INFO]:

79

2024-08-31T15:34:35.982Z [INFO]: Collecting cachetools<6,>=4.0

80

2024-08-31T15:34:35.991Z [INFO]: Downloading cachetools-5.5.0-py3-none-any.whl (9.5 kB)

81

2024-08-31T15:34:36.092Z [INFO]: Collecting dnspython<3.0.0,>=1.16.0

82

2024-08-31T15:34:36.141Z [INFO]: Downloading dnspython-2.6.1-py3-none-any.whl (307 kB)

83

2024-08-31T15:34:36.147Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.7/307.7 kB 75.5 MB/s eta 0:00:00

84

2024-08-31T15:34:36.148Z [INFO]:

85

2024-08-31T15:34:36.252Z [INFO]: Collecting narwhals>=1.5.2

86

2024-08-31T15:34:36.262Z [INFO]: Downloading narwhals-1.6.0-py3-none-any.whl (154 kB)

87

2024-08-31T15:34:36.267Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.6/154.6 kB 49.5 MB/s eta 0:00:00

88

2024-08-31T15:34:36.267Z [INFO]:

89

2024-08-31T15:34:36.270Z [INFO]: Requirement already satisfied: jsonschema>=3.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (4.19.2)

90

2024-08-31T15:34:36.270Z [INFO]: Requirement already satisfied: jinja2 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (3.1.2)

91

2024-08-31T15:34:36.420Z [INFO]: Collecting typing-extensions<5,>=4.3.0

92

2024-08-31T15:34:36.473Z [INFO]: Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB)

93

2024-08-31T15:34:36.637Z [INFO]: Collecting gitdb<5,>=4.0.1

94

2024-08-31T15:34:36.679Z [INFO]: Downloading gitdb-4.0.11-py3-none-any.whl (62 kB)

95

2024-08-31T15:34:36.683Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.7/62.7 kB 24.9 MB/s eta 0:00:00

96

2024-08-31T15:34:36.684Z [INFO]:

97

2024-08-31T15:34:36.856Z [INFO]: Collecting tzdata>=2022.7

98

2024-08-31T15:34:36.866Z [INFO]: Downloading tzdata-2024.1-py2.py3-none-any.whl (345 kB)

99

2024-08-31T15:34:36.872Z [INFO]: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 345.4/345.4 kB 77.7 MB/s eta 0:00:00

100

2024-08-31T15:34:36.873Z [INFO]:

101

2024-08-31T15:34:36.879Z [INFO]: Requirement already satisfied: pytz>=2020.1 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from pandas<3,>=1.3.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (2023.3.post1)

102

2024-08-31T15:34:36.880Z [INFO]: Requirement already satisfied: python-dateutil>=2.8.2 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from pandas<3,>=1.3.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (2.8.2)

103

2024-08-31T15:34:36.974Z [INFO]: Requirement already satisfied: urllib3<3,>=1.21.1 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from requests<3,>=2.27->Streamlit==1.38.0->-r requirements.txt (line 2)) (2.0.7)

104

2024-08-31T15:34:36.975Z [INFO]: Requirement already satisfied: idna<4,>=2.5 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from requests<3,>=2.27->Streamlit==1.38.0->-r requirements.txt (line 2)) (3.4)

105

2024-08-31T15:34:36.976Z [INFO]: Requirement already satisfied: certifi>=2017.4.17 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from requests<3,>=2.27->Streamlit==1.38.0->-r requirements.txt (line 2)) (2023.7.22)

106

2024-08-31T15:34:36.976Z [INFO]: Requirement already satisfied: charset-normalizer<4,>=2 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from requests<3,>=2.27->Streamlit==1.38.0->-r requirements.txt (line 2)) (3.3.2)

107

2024-08-31T15:34:37.013Z [INFO]: Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from rich<14,>=10.14.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (2.16.1)

108

2024-08-31T15:34:37.014Z [INFO]: Requirement already satisfied: markdown-it-py>=2.2.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from rich<14,>=10.14.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (3.0.0)

109

2024-08-31T15:34:37.104Z [INFO]: Collecting smmap<6,>=3.0.1

110

2024-08-31T15:34:37.114Z [INFO]: Downloading smmap-5.0.1-py3-none-any.whl (24 kB)

111

2024-08-31T15:34:37.195Z [INFO]: Requirement already satisfied: MarkupSafe>=2.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from jinja2->altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (2.1.3)

112

2024-08-31T15:34:37.248Z [INFO]: Requirement already satisfied: referencing>=0.28.4 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (0.30.2)

113

2024-08-31T15:34:37.249Z [INFO]: Requirement already satisfied: rpds-py>=0.7.1 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (0.12.0)

114

2024-08-31T15:34:37.250Z [INFO]: Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (2023.7.1)

115

2024-08-31T15:34:37.251Z [INFO]: Requirement already satisfied: attrs>=22.2.0 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from jsonschema>=3.0->altair<6,>=4.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (23.1.0)

116

2024-08-31T15:34:37.274Z [INFO]: Requirement already satisfied: mdurl~=0.1 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14,>=10.14.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (0.1.2)

117

2024-08-31T15:34:37.330Z [INFO]: Requirement already satisfied: six>=1.5 in /root/.pyenv/versions/3.10.13/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas<3,>=1.3.0->Streamlit==1.38.0->-r requirements.txt (line 2)) (1.16.0)

118

2024-08-31T15:34:42.539Z [INFO]: Installing collected packages: tzdata, typing-extensions, tornado, toml, tenacity, smmap, python-dotenv, protobuf, pillow, numpy, narwhals, dnspython, cachetools, pymongo, pydeck, pyarrow, pandas, gitdb, gitpython, altair, Streamlit

119

2024-08-31T15:34:42.654Z [INFO]: Attempting uninstall: typing-extensions

120

2024-08-31T15:34:42.655Z [INFO]: Found existing installation: typing_extensions 4.8.0

121

2024-08-31T15:34:42.694Z [INFO]: Uninstalling typing_extensions-4.8.0:

122

2024-08-31T15:34:53.624Z [INFO]: Successfully uninstalled typing_extensions-4.8.0

123

2024-08-31T15:35:03.234Z [INFO]: Successfully installed Streamlit-1.38.0 altair-5.4.1 cachetools-5.5.0 dnspython-2.6.1 gitdb-4.0.11 gitpython-3.1.43 narwhals-1.6.0 numpy-2.1.0 pandas-2.2.2 pillow-10.4.0 protobuf-5.28.0 pyarrow-17.0.0 pydeck-0.9.1 pymongo-4.8.0 python-dotenv-1.0.0 smmap-5.0.1 tenacity-8.5.0 toml-0.10.2 tornado-6.4.1 typing-extensions-4.12.2 tzdata-2024.1

124

There is no additional information that led to build time out error. The environment variable _BUILD_TIMEOUT is set to 120 and still same result. Unsure of what the issue could be? Background - application code is python with streamlit framework, 99% static content with a scheduling module which is real time dynamic.

Don't know how to proceed, any help would be greatly appreciated.

Reproduction steps

The amplisy.yml is attached above, The Repository is krtallc:main

environment variable _BUILD_TIMEOUT is set to 120

dataminion commented 2 months ago

Question, did you recently integrate a more complex service into your build?

You can increase the build timeout threshold in the amplify control console

We had this problem when we first integrated an opensearch cluster into our build. the build timed out but going to the cloud formation console we could see that the cloud formation stacks did finish ultimately once the initial cluster was up the jobs would go back to being fast again but complex changes to the cluster would still drag a bit.

We are currently considering two solutions moving to a split front end backend project style so that we can give the backend the time it needs complete and speedup front end deploys.

Alternatively we are exploring breaking out big ticket items like cognito and opensearch and some analytical things cross account to a central account then making these resources available cross account refereces to the smaller serverless projects.

ykethan commented 2 months ago

Hey @krtallc, could you provide us the App-id, region and name of the branch?

krtallc commented 2 months ago

@dataminion and @ykethan and team, greetings! I appreciate your response.

@dataminion - I had not integrated any complex services. At a high level it is a static 3 page webpage with option of selecting an appointment schedule to receive a calendar invite with appointment slot selected for the services provided.

Even with _BUILD_TIMEOUT set to 120 timeout happened. I am glad to see the cloud formation stacks finished.

@ykethan - I deleted all the created deployments and started working on a local cli test build manually. So I recreated a new build which failed again. Here are the details: Region: us-east-1 All apps / krtallc_20240831 / main / Deployments Deployments Deployment 1 Failed Started at

9/4/2024, 7:26 PM Build duration

30 minutes 18 seconds Domain

https://main.d360tpbeqlbhhk.amplifyapp.com Repository

krtallc_20240831:main Last commit

Auto-build Name of the branch is main

ykethan commented 2 months ago

Hey, thank you for your patience. On diving into the logs did notice the streamlit run streamlit_app.py created a server with addresses which timed out. Amplify hosting currently does not support running a long running process such as server. Currently Amplify deploys you build artifacts to CloudFront. For example in a nextJS App

frontend:
  phases:
    preBuild:
      commands:
        - npm ci --cache .npm --prefer-offline
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'

The application is build and the artifact is then deployed to the CDN. refer to this documentation.

While i am not familiar with streamlit, i was able to find a aws-sample app that may help with your use case

Jay2113 commented 1 month ago

@krtallc 👋 , as stated previously the Amplify builds have failed due to timing out after 30 minutes (the default timeout limit). However, we do support a maximum build timeout of 2 hours. For deploying Streamlit based Python apps, we recommend reducing the number of long running commands executed during the build or optimize the build process to ensure faster execution as this can help prevent timeout issues.

Closing the thread since the root cause has been identified for the build failures.