Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding caching options to amplify.yml causes "Build container ran out of memory" #3925

Open
3 tasks done
armenr opened this issue Apr 26, 2024 · 2 comments
Open
3 tasks done
Labels
feature-request New feature or request

Comments

@armenr
Copy link

armenr commented Apr 26, 2024

Before opening, please confirm:

Amplify Hosting feature

Deployments

Is your feature request related to a problem? Please describe:

When I add the following to my amplify.yaml, my builds begin to fail with the error message: Build container ran out of memory

  cache:
    paths:
      - node_modules/**/*
      - $(pnpm store path)

I can confirm that the build logs show our code builds successfully, all the way to the end of our build steps...and the failure happens after our frontend is already built and ready to be deployed.

Removing the cache settings returns our build pipelines to a working condition.

We're using pnpm version 9 with workspaces and the following .npmrc settings:

shamefully-hoist=true
package-import-method=copy
link-workspace-packages=false

Based on information I've found in other issues, I even do the following in our pipeline, in an attempt to side-step memory-related limitations for my builds:

      commands:
        - |
          # Set up swap space
          echo "Setting up swap space..."
          sudo fallocate -l 32G /swapfile
          sudo chmod 600 /swapfile
          sudo mkswap /swapfile
          sudo swapon /swapfile
          sudo swapon -s
          echo "Done setting up swap space!"

Describe how you'd like this feature to work

We'd like to benefit from using the cache for faster builds.

@armenr armenr added the feature-request New feature or request label Apr 26, 2024
Copy link

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@CGarces
Copy link

CGarces commented May 5, 2024

Can you please try just

  cache:
    paths:
      - "$(pnpm store path)"

I think that node_modules is just soft links over pnpm cache so you are storing information twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants