How are compiled CSS and JavaScript files handled with S3?

I have my Drupal site set up to upload public files into the S3 bucket but am having some strange behavior with different environments and different s3 buckets. I have 3 s3 buckets: one for our production environment, one for our staging environment, and one for my development environment. The Drupal configurations are set up to point to their respective s3 bucket based on environment.

There’s been a couple of instances now where our staging instance is working perfectly fine and it’s s3 bucket has the compiled css and js files, and then after a random deployment from development (not every deployment though) the staging instance is failing to load a css resource because it doesn’t exist in the respective S3 bucket because the css resource it’s trying to load actually exists in the development environment’s s3 bucket.

How does drupal handle loading these resources, like, where does it actually retrieve the filenames from? I’m just trying to figure out why it’s trying to retrieve a filename for a resource that was generated in development instead of the filename for a resource that it generates?


The deployments never contain any of thing in the codebase related to which files to load.