Adarsha23 / Adarsha23/petfeeder
[BUG] Cannot create pet profiles - RLS policy violation
- 主要語言
- JavaScript
- 星號
- 1
- 分支
- 0
- PR 合併指標
- 30 天內沒有已合併 PR
描述
**Description**:
```markdown
## Problem
Getting 403 Forbidden error when trying to create a pet profile through the frontend.
## Error Message
code: "42501" message: "new row violates row-level security policy for table "pet_profiles""
## Root Cause
The `002_fix_rls_policies.sql` script dropped all policies but didn't recreate the INSERT policy for `pet_profiles`.
## Steps to Reproduce
1. Login to dashboard
2. Click "Add Pet Profile"
3. Fill in pet details
4. Click "Create Profile"
5. Check browser console
6. See 403 error
## Expected Behavior
Pet profile should be created and saved to database
## Actual Behavior
Request fails with RLS policy violation
## Solution
Add INSERT policy:
```sql
CREATE POLICY "Users can insert their own pet profiles"
ON pet_profiles FOR INSERT
WITH CHECK (auth.uid() = user_id);
## Related Files
src/services/petProfileService.js
supabase/migrations/003_add_missing_policies.sql
## Branch
feature/supabase-integration
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Start by reading 002_fix_rls_policies.sql and the related migration src/services/petProfileService.js mentions, then reproduce the failure from the dashboard's Add Pet Profile flow. The work is done when an authenticated user can create and save their own pet profile without the 403 RLS violation; verify the browser console no longer reports error 42501.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, sql
- 領域
- database
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100