Adarsha23 / Adarsha23/petfeeder
[BUG] Cannot create pet profiles - RLS policy violation
- Linguagem predominante
- JavaScript
- Estrelas
- 1
- Forks
- 0
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
**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
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, sql
- Domínio
- database
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 35/100