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

How to invalidate build cache?

Open kkesley opened this issue 4 years ago • 5 comments

** Please describe which feature you have a question about? **

Amplify build process

** Provide additional details**

I'm currently seeing failing builds on my Amplify project (React). I believe this is because we rewrote our react app from JS to TS. It complains about unsupported syntax because we upgraded some packages in our project. I believe I've seen this problem when we used CodeBuild and we solved it by using the invalidate-project-cache command.

Is there a similar command from Amplify?

kkesley avatar Mar 17 '20 10:03 kkesley

We can do rm -rf node_modules in the build step for now. But it would be nice if we can invalidate the cache from outside the build

kkesley avatar Mar 17 '20 10:03 kkesley

Hi @kkesley, this isn't something we support but your feedback is helpful, we'll take this as a feature request. Glad you were able to unblock yourself in the meantime.

kahdojay avatar Mar 20 '20 18:03 kahdojay

+1 for this, I ran into this issue today. It would be great to disable the build cache and specify specific paths inside amplify.yml.

hirenumradia avatar Feb 07 '21 00:02 hirenumradia

+1 for this feature too. I've ran into headaches where I've upgraded from a trial package to a commercial package and instead of the build process grabbing the packages from a private repository, the trial ones have been used, despite the .npmrc file being there. I even tried doing manual login steps in the build file, but nada. As soon as I removed the cache parameters, it worked just fine. Since my initial head scratch moment, I raised a ticket with AWS support and they pointed me here. Being able to purge the build cache from outside the pipeline would be great in troubleshooting things like this. I lost a few hours to this problem. You can remove packages from the build env with commands, but it means having to mess around with the pipeline config until you get to a happy build outcome.

davedotdev avatar Jun 28 '22 10:06 davedotdev

Nice to have feature! Having issues seeing deployed changes Using Nextjs 12 and Amplify. Also, it takes too long to deploy changes. We are talking about a simple blog-style website with an API route.

BTW, no problems whatsoever with Vercel. Deployed in seconds with changes live as expected.

natBizitza avatar Sep 21 '22 07:09 natBizitza

+1 We faced a similar issue when migrating our application from Amplify 4.x to 5.x, and to deal with it, we changed our build settings, clearing the node_modules to fix it. However, as mentioned, this is not a good approach, because we need to revert this change every time or disable the cache. It'll really be nice if we could do this through a button in the AWS console.

gustavostachera avatar Dec 01 '22 17:12 gustavostachera