fix(studio): handle unexpected error response formats in self-hosted query#41980
fix(studio): handle unexpected error response formats in self-hosted query#41980ooleem-generator wants to merge 1 commit intosupabase:masterfrom
Conversation
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
@ooleem-generator is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe changes introduce a fallback error parsing mechanism to handle non-conforming error responses gracefully, update the encryption key constant to a standardized placeholder value, and add the corresponding environment variable configuration. Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Closing this in favor of PR #42155 to follow the contribution guidelines (branch naming convention). |
I have read the CONTRIBUTING.md file.
YES
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Fixes #41698
In self-hosted environments, the SQL Editor and Authentication pages return 500 errors and throw Zod validation errors:
Invalid input: expected string, received undefined

Root causes:
1.

PG_META_CRYPTO_KEYmismatch: The Docker.envdefinesPG_META_CRYPTO_KEY, butapps/studio/.envwas missing this variable. Additionally, the fallback value inapps/studio/lib/api/self-hosted/constants.tsdidn't match the Docker.envvalue, causing encryption key mismatches and 500 errors from pg-meta endpoints.2. Strict Zod validation:
databaseErrorSchema.parse()throws when error response fields like code or formattedError are undefined.What is the new behavior?
1. Synced
PG_META_CRYPTO_KEYconfiguration:PG_META_CRYPTO_KEYtoapps/studio/.envconstants.tsto match the Docker.envdefault2. Resilient error handling: Uses

safeParse()instead ofparse()for graceful handling of unexpected error response formatsAdditional context
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.