amplify-hosting
amplify-hosting copied to clipboard
[Enhancement] : Please support UmiJS and Ant Design Pro
Is your feature request related to a problem? Please describe.
Hello, I tried to deploy Ant Design Pro but it never succeed at first, second, or even third times. It mostly failed in build phase. I had to redeploy the same version for 9 or even 37 times which eventually made me deleted the app and recreated it again, yet I had to try building it again for 16 times. It would be a pleasure if you add UmiJS and Ant Design Pro support to AWS Amplify console.
It always fails with this message :


Describe the solution you'd like
I expect if AWS Amplify Console fails, there should be clear explanation reason why it fails. Maybe exit code, timeout, missing something, etc... either way should be as detailed as possible to help developer diagnose.
Also, Could you please support UmiJS and Ant Design Pro ?
The exact same project can be build successfully in Vercel and Netlify. So there's potential that it's an Amplify Console bug, but we don't know yet.
Any solution and feedback will be appreciated.
@kevinadhiguna are you getting a build error?
@kevinadhiguna Could you share your appId which is part of the appArn and if you can also give the region where this is happening and we can investigate further.
Seems related/similar to #1647
To me it looks like bug, instead of feature enhancement.
Hello @swaminator and @ganipcanot , thanks for your response.
This is my appId : doss5y9r2kl4x. Region : Bahrain me-south-1.
Yes, the build phase failed but I did not get any error messages.
It looks like the build container is running out of memory on the caching step, can you try omitting the node_modules/.cache directory and see if that helps? And if that doesn't work, remove cache entirely from your buildspec?
@behrooziAWS that makes sense.
Since it is one of known issues, may I suggest the following:
- Put "Caching [paths]..." message in the log, so we know what it is doing.
- If the build runs out of memory, put a message in the log "Build has run out of memory during caching. Hint: You may want to reduce node_modules cache size, see https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#how-to-reduce-node_modules-cache-size"
- Make it very clear in the build status that it failed due to Out of Memory, especially during caching. instead of "just failed". The communication problem here is that the build itself worked. It's just the caching process, which happens "after" the build, that is problematic.
@behrooziAWS build still failed after excluding node_modules/.cache
To be exact, that .cache folder has very little content:

We made it build successfully (at least once) using:
cache:
paths:
- node_modules/**/*
- '!node_modules/.cache'
- '!node_modules/ant-design-pro'
The reason I tried to exclude ant-design-pro is that yarn for some reason seems to install it as symlink:

@ceefour Big Thanks, that solution did a magic ! I made a couple of changes and passed all phases (twice).

However, I still would like to understand more and wait to ensure if it will work continously...
The problem is this:
node_modules/ant-design-pro/node_modules/ant-design-pro -> symlinks back to -> node_modules/ant-design-pro
so it seems that ant-design-pro depends back to itself in an infinite cycle.
@kevinadhiguna I'd say you should file an issue at ant-design-pro to find out why this is the case.
In Amplify, it's possible to exclude node_modules/ant-design-pro but still, unless we know exactly the problem, the build error message is incomplete and thus misleading..
When a build is successful, we can see:
...
2021-03-24T18:40:03.683Z [INFO]: Done in 49.34s.
2021-03-24T18:40:03.688Z [INFO]: # Completed phase: build
2021-03-24T18:40:03.688Z [INFO]: ## Build completed successfully
2021-03-24T18:40:03.689Z [INFO]: # Starting caching...
2021-03-24T18:40:03.770Z [INFO]: Creating cache artifact...
2021-03-24T18:40:20.652Z [INFO]: # Cache artifact is: 885MB
2021-03-24T18:40:20.713Z [INFO]: # Uploading cache artifact...
2021-03-24T18:40:29.166Z [INFO]: # Caching completed
The issue is, when something went wrong during cache, none of the above lines are output in the log...
I'd expect something like this (proposal) when caching failed, either due to out of memory, recursive symlinks, etc.:
...
2021-03-24T18:40:03.683Z [INFO]: Done in 49.34s.
2021-03-24T18:40:03.688Z [INFO]: # Completed phase: build
2021-03-24T18:40:03.688Z [INFO]: ## Build completed successfully
2021-03-24T18:40:03.689Z [INFO]: # Starting caching...
2021-03-24T18:40:03.770Z [INFO]: Creating cache artifact...
ERROR: Out of memory when caching "node_modules/ant-design-pro/node_modules/ant-design-pro"
Hint: You may want to reduce node_modules cache size, see https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#how-to-reduce-node_modules-cache-size
@ceefour Thanks for that feedback. The code that should log isn't getting executed due to the out of memory, and there are a couple things we can do to surface it better as you suggest. I was working on a fix to automatically omit .cache regardless of whether the developer explicitly omits it, and will see if we can detect symlink cycles or non-essential intermediate files that shouldn't be cached.
Hi, I think this issue is happening again, even though I already included:
cache:
paths:
- node_modules/**/*
- '!node_modules/.cache'
- '!node_modules/ant-design-pro'
in amplify.yml as @ceefour suggested.
This is the amplify.yml I used:
version: 1
frontend:
phases:
preBuild:
commands:
- nvm install 14
- nvm use 14
- yarn install --frozen-lockfile
build:
commands:
- nvm use 14
- cp src/appConfig.staging.json src/appConfig.json
- yarn build
artifacts:
baseDirectory: /dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
- '!node_modules/.cache'
- '!node_modules/ant-design-pro'
Here is the error message:

The behavior of AWS Amplify were:
- Provision was successfully finished.
- Build failed in Frontend
- Suddenly it comes back to Provision and says that the provision phase was failed, just like this (please open images in a new tab to be able to see message correctly, I am trying to cover all section to debug so sorry if the images are too small to view) :

This is the last log of Frontend section in Build phase:

After it said [INFO]: [success] [webpackbar] Webpack: Compiled successfully in 47.62s the build phase failed.
Any solustion is appreciated.
Hi, I think this issue is happening again, even though I already included:
cache: paths: - node_modules/**/* - '!node_modules/.cache' - '!node_modules/ant-design-pro'in
amplify.ymlas @ceefour suggested.This is the
amplify.ymlI used:version: 1 frontend: phases: preBuild: commands: - nvm install 14 - nvm use 14 - yarn install --frozen-lockfile build: commands: - nvm use 14 - cp src/appConfig.staging.json src/appConfig.json - yarn build artifacts: baseDirectory: /dist files: - '**/*' cache: paths: - node_modules/**/* - '!node_modules/.cache' - '!node_modules/ant-design-pro'Here is the error message:
The behavior of AWS Amplify were:
1. Provision was successfully finished. 2. Build failed in Frontend 3. Suddenly it comes back to Provision and says that the provision phase was failed, just like this (please open images in a new tab to be able to see message correctly, I am trying to cover all section to debug so sorry if the images are too small to view) : This is the last log of Frontend section in Build phase:
After it said
[INFO]: [success] [webpackbar] Webpack: Compiled successfully in 47.62sthe build phase failed.Any solustion is appreciated.
Pardon me, may I know why this happen (build ran out of memory)? @behrooziAWS @swaminator
Any help is very much appreciated...
I am expericing the same issue.. is there any work arround ?