Hi, recently my Amplify builds stopped working, it started to fail out of nowhere in my previews. I'm using pnpm. And the first time it failed I got the following error on preBuild:
2024-07-23T06:30:20.749Z [WARNING]: ! Unable to write cache: TAR_BAD_ARCHIVE: Unrecognized archive format)}
After that, the following builds starting failing with errors like:
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "ampx" not found
So, I tried using npx, which worked, but then I got the same error with tsx, then vite... So basically, I can't seem to use the packages anymore. After some digging, I figured out Amplify was now using a different version of pnpm, so I was able to fix the issue by letting corepack know to use version 8 of pnpm (corepack use pnpm@8), instead of version 9.
I'm still not sure why version 9 is giving me that error, but downgrading is what worked for me. However, I'm creating this issue to both help anyone with this problem, and to start a conversation on how this issue could be solved.
I updated locally everything to pnpm@9 and while locally everything seemed right, there may be something else missing to make it work in CI (Amplify Build).