Thank you for responding, my issue is isolated to a box and is not repeatable in my production environment so I think we can disregard this.
My issue seems to be similar in that when I enable Aggregation, I get the 404 errors. I have tried all the techniques here, I have ensured my folders are writable. The only exception is that I do not use nginx, I am using Apache.
If I set "file_assets_path" to a valid, writeable path, when I inspect the css and js folders, they are empty: no files get written and I obviously get 404 errors.
What is interesting is that I am able to solve this issue by adding an invalid path to my $settings['file_assets_path'].
For instance, if I set $settings['file_assets_path'] = 'sites/default/files/optimized', I get errors. If I change that path to something invalid, such as $settings['file_assets_path'] = 'sites/defualt/files/optimized' Everything works! If I search for the files, I find them in the public directory: "sites/default/files/css" or "sites/default/files/js".
However, when I look in my inspector, the URLS to the CSS/JS files will include the invalid URL, however, it's still accessible.
/sites/defualt/files/js/js_FBvJqd58OZT6lWslaaBedWyR2bsFZRC8pPvEoK4Rh6Q.js?scope=footer&delta=20&language=en&theme=gtc_barrio&include=eJyNVMGS2yAM_SESTv2Admb31Jl-QkYG2WECiCKRnd2vr7BjZxP3kIMBvfcQQkh2lBJWhyeWGgraZTL8yYLJDsBoBiJRGMppgFoD2SnSAPHA8hlDnswkbmXuUufzd-Jpi6OK1tdWIB7BSbjiQfGLcREhC8SLhTI4OZQ2xODMNeAH23k8JvItonq4xe2giu3DaYjkLv1Qq98R_BWyQ48-CNUNlpZvMc_mhLniZuE4ohOTyaMdqaaNYAcRBYZ4144VZSCofp-feev3K16xSlAXB3XBD4yjGKFokuczb2BfP6aoCemFi8aApoCcV6KvZ6Ar7EfwE8rDThYQ5CVbWe6nzqbRoZ1aWOGbacYQBeuKLpZxlyWTP2zIamdlVm8r84pGz_b4a36pV9SYyhk48Evis6T4lqeQ8SV5SDC9plxefs7rHewp7y8N8szMhfi3kez2nKmGL-oV_nuO8pFdWuAZ453_Atqc75XSn3EMbuemYqIrvv83NKamTfOmVu-CXeUmZNak8OnjHDR6IYrK2NtsGt_Loq-PwVFmlbWuadWwXlBc2wpttbd23Vw9uT6itljBnz6FvLTY4w9jF2nPFf8DwHfSjw
find . -type f -name 'js_FBvJqd58OZT6lWslaaBedWyR2bsFZRC8pPvEoK4Rh6Q.js'
returns
./web/sites/default/files/js/js_FBvJqd58OZT6lWslaaBedWyR2bsFZRC8pPvEoK4Rh6Q.js
I have not been able to determine why this is the case, but it is the only consistent way to make this work. If there are suggestions on how to debug, I would appreciate that.