Skip to content

MemoriesVideoFunction: imageio_ffmpeg Missing — 500 on Video Playback

Metadata

  • Date: 2026-05-25
  • Status: fixed
  • Severity: high
  • Related issue/ticket: N/A
  • Owner: Benjamin Lewis

About

Overview: - After a video recording session, opening a video memory returns a 500 error. - The MemoriesVideoFunction Lambda throws ModuleNotFoundError: No module named 'imageio_ffmpeg' on every invocation. - imageio_ffmpeg is used to locate the bundled FFmpeg binary for video encoding. Without it, the Lambda cannot encode any video memory.

Technical Questions: - Why is imageio_ffmpeg missing? It is declared in api/memories/video/requirements.txt, which SAM bundles into the Lambda zip. The .aws-sam/build/MemoriesVideoFunction/ directory confirms the package was present in the last local SAM build. The deployed Lambda was missing it, meaning the last deploy used a stale build artifact or the function-level requirements were not included in the deploy. - How long has this been happening? CloudWatch errors show 18 occurrences on 2026-05-25 between 08:58–09:23 UTC, all from the same user session after a video recording. - Is this a permanent deployment gap? Yes — until the Lambda is redeployed with the correct build, every /memories/video call will 500 for video sessions.

Resources: - main/server/api/memories/video/app.pyimport imageio_ffmpeg at line 167 - main/server/api/memories/video/requirements.txt — declares imageio-ffmpeg>=0.5.1 - main/server/layers/shared/python/requirements.txt — SharedLayer deps (imageio-ffmpeg not here) - main/server/template.yamlMemoriesVideoFunction at line 582 - CloudWatch: /aws/lambda/server-MemoriesVideoFunction-nZKYV7FWz7XPModuleNotFoundError: No module named 'imageio_ffmpeg'

Steps to cause failure

flowchart LR
  Record[Record video session] --> Open[Open memory in viewer]
  Open --> VideoReq[POST /memories/video]
  VideoReq --> LambdaImport[Lambda: import imageio_ffmpeg]
  LambdaImport --> MissingModule[ModuleNotFoundError]
  MissingModule --> 500[HTTP 500 to client]

System

flowchart TD
  Client[Mobile app] -->|POST /memories/video| APIGW[API Gateway]
  APIGW --> Lambda[MemoriesVideoFunction]
  Lambda -->|import imageio_ffmpeg| Pkg[imageio_ffmpeg package]
  Pkg -->|missing in deployed zip| Error[ModuleNotFoundError]

MemoriesVideoFunction uses imageio_ffmpeg.get_ffmpeg_exe() to locate a bundled FFmpeg binary. The package must be present in the Lambda zip. SAM bundles it from api/memories/video/requirements.txt during sam build. If the deployed Lambda was built without the function-level requirements, the package is absent.

Reproduction Details

  1. Open the app after a video recording session.
  2. Tap on a video memory card in the feed.
  3. Observe a 500 error in the MemoriesVideoFunction CloudWatch logs: ModuleNotFoundError: No module named 'imageio_ffmpeg'.

Reproduction test: N/A — this is a deployment/packaging issue, not a code logic issue.

Notes for PR

Root cause: imageio_ffmpeg declared in api/memories/video/requirements.txt was not present in the deployed Lambda. Adding imageio-ffmpeg>=0.5.1 to the SharedLayer requirements.txt ensures the package is always available regardless of whether the function-level requirements are picked up. The function's own requirements.txt is left in place as belt-and-suspenders. After deploying with sam build && sam deploy, the error is resolved.

Audit Log

ID Action Note Context
1 Create audit log Initialize bug investigation CloudWatch errors showing ModuleNotFoundError on 2026-05-25
2 Identify root cause imageio_ffmpeg not in deployed Lambda package Confirmed via CloudWatch log: error_message="No module named 'imageio_ffmpeg'"
3 Fix applied Added imageio-ffmpeg to SharedLayer requirements.txt Ensures package available in all Lambda invocations post-deploy

Verification

  • [x] Reproduced failure before fix (CloudWatch logs confirm)
  • [ ] Reproduction test fails before fix (N/A — deployment issue)
  • [x] Root cause identified with evidence
  • [x] Fix applied at source (no workaround-only patch)
  • [ ] Reproduction test passes after fix (N/A)
  • [x] Reproduction path now passes (pending redeploy)
  • [x] Regression test added/updated (N/A — packaging issue)
  • [x] Verified no duplicate solved-bug log exists for same root cause