fix: resolve supabase-storage crash-loop (Region is missing)#54
Conversation
…variables supabase-storage crashes with "Region is missing" after upstream image update because @aws-sdk/client-s3vectors requires REGION env var. - add REGION, GLOBAL_S3_BUCKET, STORAGE_TENANT_ID to .env.example - auto-generate S3_PROTOCOL_ACCESS_KEY_ID/SECRET in secret generation - sync new env vars to existing supabase/docker/.env during updates (append-only, never overwrites existing values) - bump version 1.3.3 → 1.4.1
📝 WalkthroughWalkthroughThis pull request introduces S3 storage configuration environment variables, upgrades the version to 1.4.1, records fixes in CHANGELOG, and enhances environment variable syncing from root .env to supabase/docker/.env. Two GitHub Actions workflows are removed. Secret generation logic for S3 credentials is added to the setup script. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.env.example (1)
424-424: Minor: Extra blank lines detected.Static analysis flagged extra blank lines at lines 424 and 442. Consider removing one blank line to maintain consistency with the rest of the file.
🔧 Suggested fix
- - ############ # Storage - Configuration for S3 protocol endpoint ############And similarly remove one blank line before line 443.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.env.example at line 424, Remove the extraneous blank lines in .env.example around the noted areas: delete the extra empty line at the block near line 424 and the extra empty line before line 443 so the file spacing matches the surrounding sections; no code changes required—just remove those blank lines to maintain consistent formatting.start_services.py (1)
89-92: Consider: Edge case with values containing both$and single quotes.The quoting logic uses single quotes when
$is present in the value. If a value contains both$and'characters, this could result in malformed output.However, this matches the existing pattern in
03_generate_secrets.sh(line 264-268), so it's consistent with the codebase. Generated secrets (hex, base64, passwords) won't contain single quotes, making this a theoretical rather than practical concern.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@start_services.py` around lines 89 - 92, The current quoting logic in the new_vars assembly (using key and value) chooses single quotes when a '$' is present which breaks if value also contains a single quote; update the branch that builds new_vars (the code referencing new_vars.append(f"{key}='...') / new_vars.append(f'{key}=\"...\"') and the variables key/value) to detect values that contain both "$" and "'" and handle them by escaping single quotes using the shell-safe pattern: replace each single quote in value with '\'' and then wrap the whole in single quotes (i.e. produce key='...'\''...'), so the resulting string is always well-formed in the shell for all combinations of $ and ' characters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.env.example:
- Line 424: Remove the extraneous blank lines in .env.example around the noted
areas: delete the extra empty line at the block near line 424 and the extra
empty line before line 443 so the file spacing matches the surrounding sections;
no code changes required—just remove those blank lines to maintain consistent
formatting.
In `@start_services.py`:
- Around line 89-92: The current quoting logic in the new_vars assembly (using
key and value) chooses single quotes when a '$' is present which breaks if value
also contains a single quote; update the branch that builds new_vars (the code
referencing new_vars.append(f"{key}='...') / new_vars.append(f'{key}=\"...\"')
and the variables key/value) to detect values that contain both "$" and "'" and
handle them by escaping single quotes using the shell-safe pattern: replace each
single quote in value with '\'' and then wrap the whole in single quotes (i.e.
produce key='...'\''...'), so the resulting string is always well-formed in the
shell for all combinations of $ and ' characters.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 67a3aecf-6809-40fe-92af-af934567780d
📒 Files selected for processing (7)
.env.example.github/workflows/claude-code-review.yml.github/workflows/claude.ymlCHANGELOG.mdVERSIONscripts/03_generate_secrets.shstart_services.py
💤 Files with no reviewable changes (2)
- .github/workflows/claude-code-review.yml
- .github/workflows/claude.yml
Summary
Error: Region is missing) by adding missing S3 storage configuration variables (REGION,GLOBAL_S3_BUCKET,STORAGE_TENANT_ID, S3 protocol keys) from upstream SupabaseS3_PROTOCOL_ACCESS_KEY_IDandS3_PROTOCOL_ACCESS_KEY_SECRETduring installationsupabase/docker/.envduring updates (append-only, preserves existing values)Root cause
The upstream Supabase storage image now uses
@aws-sdk/client-s3vectorswhich requires aREGIONenv var. Our.env.examplewas missing this and related S3 variables. Additionally,prepare_supabase_env()previously skipped entirely ifsupabase/docker/.envalready existed, so new variables from updates never propagated.Test plan
make updatesupabase-storagestarts without errorsmake doctorshows no errors for supabase-storagemake show-restartsshows 0 restarts for supabase-storagegrep REGION supabase/docker/.envshowsREGION=stubSummary by CodeRabbit
Bug Fixes
Chores