amplify-hosting icon indicating copy to clipboard operation
amplify-hosting copied to clipboard

AmplifyPush on AWS Amplify portal different from amplify push in cmd line

Open eric-zhu-uw opened this issue 3 years ago • 4 comments

Before opening, please confirm:

App Id

dofeuoscsvwes

Region

ca-central-1

Amplify Hosting feature

Backend builds

Describe the bug

When running amplify push locally, I am able to successfully push my Amplify project to the cloud. However, when I trigger the exact same build through AWS Amplify portal, it results in the build failing. The only difference being it uses amplify push vs amplifyPush on the AWS Amplify portal (which is recommended by the docs).

Expected behavior

I expect both backend builds to be able to build properly. Currently, since I am unable to build through the AWS Amplify portal, I am unable to build my front-end (dependency).

Reproduction steps

  1. amplify pull --appId dofeuoscsvwes --envName dev
  2. amplify push
  3. Try to build the app in the portal and it will result in a build failure.

I have attached an example of the failing logs from the AWS amplify portal. There is no indication on why the build is failing. It's 2022-08-22T21:33:27.156Z [INFO]: Installing dependencies from Pipfile.lock (0b4aaa)... and then all of sudden, the build crashes with no error messages. log.txt

Build Settings

amplify.yml

version: 1
backend:
  phases:
    build:
      commands:
        - update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.8 10 
        - /usr/local/bin/pip3.8 install --user pipenv
        - amplifyPush --environment dev
  • python 3.8
  • node 14
  • amplify cli - 9.2.1


### Additional information

Is there a reason why the behaviour is different. Alternatively, it would be great if the build logs from the AWS Amplify portal provided an error message on why exactly it's failing.

eric-zhu-uw avatar Aug 22 '22 21:08 eric-zhu-uw

Hi @eric-zhu-uw your build failed because the build container ran out of memory. Can you try to set environment variable NODE_OPTIONS to --max-old-space-size=4096?

ghost avatar Aug 23 '22 21:08 ghost

@hloriana I set the environment variable NODE_OPTIONS to --max-old-space-size=4096 and --max-old-space-size=6144 all resulting in the same crashing build. How were you able to confirm that the build container ran out of memory or that this was the root cause?

Also on a different note, is there any way to limit the memory usage of the build? Maybe that could be a work around to get the build not to crash.

eric-zhu-uw avatar Aug 24 '22 03:08 eric-zhu-uw

Also it like the build environment is already provisioned with 7GB of memory which seems to be unadjustable. image

eric-zhu-uw avatar Aug 24 '22 03:08 eric-zhu-uw

@hloriana Would it be possible to get some more insights on why this build is failing? There is no error message for me to work and I'm unable to replicate the issue locally.

eric-zhu-uw avatar Aug 26 '22 17:08 eric-zhu-uw