Trouble with Programmatically Updating Media URLS in API to Cloudfront domain URL

The code should be after await next()