how to remove laravel vapor cloudfront public assets caches on fresh deployment

847 Views Asked by At

I have a Laravel and VueJs application. I recently migrated the application to Laravel Vapor. I am using webpack code splitting feature.

https://docs.vapor.build/1.0/projects/deployments.html#code-splitting-dynamic-imports

The problem is, whenever I push new changes to vapor, any change that I have made related to VueJs/Javascript, doesn't reflects in the new deployment.

As per my understanding, the problem might be due to CloudFront Cache as vapor moves all public assets to CloudFront or it might be something else.

Please let me know, how can fix this.

Thanks

1

There are 1 best solutions below

0
On

It was due to my mistake in the code. I was using the wrong CloudFront URL, it was hardcoded in .env ASSET_URL but Vapor generates a new URL on each fresh deployment and automatically injects it in .env file and that we have to use as per docs https://docs.vapor.build/1.0/projects/deployments.html#assets

Thanks