按AWS CloudFront博客操作后HLS编码目标文件夹未生成求助
I’ve worked through similar CloudFront + S3 + MediaConvert workflow issues before, so let’s break down the most likely causes and fixes for your missing HLS/ folder and date-suffixed subfolder:
Common Troubleshooting Steps
Verify your S3 Lambda Trigger Configuration
Double-check that your S3 bucket’s trigger is linked to the correct HLS encoding Lambda function. Ensure:- The trigger event type is set to ObjectCreated (e.g.,
All object create eventsor specificallyPut/Postdepending on your upload method) - The prefix/suffix filters match your uploaded video files (e.g., if uploading
.mp4files, the suffix should be.mp4—a mismatch means the trigger won’t fire) - The Lambda execution role has all required permissions:
s3:GetObjecton your source bucket,s3:PutObjecton your output bucket, and full access to MediaConvert (or at least permissions to submit jobs and read job status)
- The trigger event type is set to ObjectCreated (e.g.,
Check Lambda Function Logs in CloudWatch
Head to CloudWatch Logs, find the log group for your encoding Lambda, and scan for error messages. Common issues here include:AccessDeniederrors (indicates missing IAM permissions)- Failed MediaConvert job submissions (e.g., invalid input file paths, unsupported video formats)
- Date formatting bugs in the code that’s supposed to generate the date-suffixed subfolder (an error here could send output to the wrong location or prevent it from being created entirely)
Inspect MediaConvert Job Status
If your workflow uses Amazon MediaConvert for HLS encoding, go to the MediaConvert console and check if a job was created when you uploaded your video:- If no job exists: Your Lambda function didn’t trigger (circle back to verifying the S3 trigger)
- If the job failed: Review the job’s error details—this could stem from unsupported input video codecs, incorrect output bucket permissions, or invalid output settings
Validate Output Path Configuration
Review your Lambda function’s code that defines the output S3 path. Make sure it explicitly writes to anHLS/parent folder with a date-suffixed subfolder. For example, if the code uses something likeHLS/${new Date().toISOString().slice(0,10)}, check for typos or date formatting issues that might break the path structure.Test with a Standard Video File
Sometimes the issue lies with the video file itself. Try uploading a widely compatible.mp4file (H.264 video, AAC audio) to rule out format compatibility problems with MediaConvert.Check for Blog Step Updates
AWS services and best practices evolve over time. If the blog post is older, some steps might be outdated:- IAM permission requirements for MediaConvert or Lambda may have changed
- MediaConvert’s API endpoints or default settings could be different
- The sample code provided in the blog might need adjustments for newer Lambda runtimes (e.g., Node.js 18+ vs. older versions)
内容的提问来源于stack exchange,提问作者Nikhil

