AOSSIE-Org / AOSSIE-Org/NeuroTrack

BUG: "An error occurred, please try again" After Google Sign-In

Đang mở
#87 6 bình luận 0 reaction 1 người được giao Được @TriptiMirani nhận Xem trên GitHub
Ngôn ngữ chính
Dart
Star
29
Fork
50
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Is there an existing issue for this?

- [x] I have searched the existing issues

### What happened?

## 📌 Issue Overview
When a user(patient) clicks "Continue with Google", they first receive a green pop-up message:
✅ "Signed in as FirstName LastName"
This indicates that Google Sign-In was successful.

However, immediately afterward, they receive a red pop-up message:
❌ "An error occurred, please try again."

After debugging, we discovered that the root cause of this error was the patient table missing in Supabase deployment.

## 🔍 Steps to Reproduce

1. Open the Flutter Patient app.
2. Click "Continue with Google".
3. Observe the green pop-up confirming successful sign-in.
4. Observe the red pop-up with the error message.
5. Check the Flutter logs for the Supabase relation "public.patient" does not exist error.

## 🎯 Expected Behavior

- After signing in with Google, a user should be redirected to the appropriate screen (home or personal details).
- No error should be shown if authentication is successful.
- If a new user signs in for the first time, their patient record should be created automatically.

## 🚨 Actual Behavior

1. User clicks "Continue with Google".
2. Google authentication succeeds (green pop-up).
3. The app attempts to check if the user exists in the patient table.
4. API call fails because the patient table does not exist in Supabase.
5. A generic error is shown (red pop-up: "An error occurred, please try again").

The Flutter logs show the following error:
```
I/flutter (21358): Error checking patient existence:
PostgrestException(message: {"code":"42P01","details":null,"hint":null,"message":"relation \"public.patient\" does not exist"},
code: 404, details: Not Found, hint: null)
```
🔹 This confirms that Supabase is rejecting queries because the patient table is missing.

## 💡 Suggested Improvements

Automatically Create the patient Table via Supabase Migrations.

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.