Open akila-ocj opened 3 days ago
Hi @akila-ocj 👋 , thanks for reaching out. You've correctly stated that this issue occurs since the build output size exceeds 220 MB due to the size of the node_modules
being copied over to the .amplify-hosting/compute/default
directory. In the long term, to mitigate it the process of copying over the node_modules
will need to be optimized and tree shaking will need to be implemented.
In the short term, our recommendation will be to review this troubleshooting guide and manually remove the binaries or node_modules
that aren't required at runtime.
After downloading the build artifacts, you can review the dependencies locally:
- cd compute/default/node_modules
- du -csh *
Identify dependencies that you can remove
Next, modify the amplify.yml
to remove them at buildtime:
build:
commands:
- npm run build
- npm prune --omit=dev --omit=optional
- rm -rf node_modules/{deps1}
- rm -rf node_modules/{deps2}
- mv node_modules ./.amplify-hosting/compute/default
Environment information
I am trying to deploy below template using AWS amplify: https://astro.build/themes/details/copper-astro/. My build output is approximately 424 MB, exceeding the limit of 220 MB. I am reporting this as a bug since I cannot control the max allowed size in Amplify.
I followed the steps in the aws doc to deploy the web app: https://docs.aws.amazon.com/amplify/latest/userguide/get-started-astro.html
The instruction in the above aws doc:
causes an error due to the max allowed size of 230686720 bytes.
Build image: Amazon Linux 2023
Describe the bug
Below is the deployment log:
Reproduction steps
Hosting the same website on amplify using the aws docs. Its a paid template I already downloaded it happy to email you the template if you need it.