Receiving an AuthException(message: AuthRetryableFetchError, statusCode: null) in my Flutter Web App when creating a user in Supabase

In my Web Administration Page made in Flutter that uses Supabase, I have a function/page to create a new user. However, I am encountering the error “AuthException(message: AuthRetryableFetchError, statusCode: null)” when trying to execute the insertion of the user. I have this function/data repository that inserts the data first in the auth.users table then to the public.profiles table for the user’s details.

Here is the data repository code:

Future<String?> createUserAndProfile(
    String email,
    String password,
    String firstName,
    String middleName,
    String lastName,
    String accountType,
    String? empId,
    int? regionId,
    int? provinceId,
    int? municipalityId) async {
  final supabase = Supabase.instance.client;
  try {
    final authResponse =
        await supabase.auth.signUp(email: email, password: password);

    if (authResponse.user == null) {
      return "Error in saving in database (auth)";
    }

    final user = authResponse.user!;

    final profileResponse = await supabase.from('profiles').insert({
      'id': user.id,
      'email': email,
      'firstname': firstName,
      'middlename': middleName,
      'lastname': lastName,
      'account_type': accountType,
      'employee_id': empId,
      'region_id': regionId,
      'province_id': provinceId,
      'municipality_id': municipalityId,
    });

    if (profileResponse.error != null) {
      return 'Error creating profile: ${profileResponse.error!.message}';
    } else {
      print('Profile created successfully!');
      return null;
    }
  } on AuthException catch (e) {
    return e.message; // Return the specific error message from AuthException
  } catch (e) {
    return 'An unexpected error occurred: ${e.toString()}';
  }
}

Here is the code snippet/function to where the function above is called:

Future<void> _handleSignUp() async {
    if (_formKey.currentState!.validate()) {
      final email = _emailController.text.trim();
      final password = _passwordController.text.trim();
      final firstName = _firstNameController.text.trim();
      final middleName = _middleNameController.text.trim();
      final lastName = _lastNameController.text.trim();
      final empId = _employeeIdController.text.trim();

      /*
      print('Email: $email, password: $password');
      print('Name: $firstName $middleName $lastName');
      print('Employee Number: $empId');
      print(
          'Region: $_selectedRegionId, Province: $_selectedProvinceId, Municipality: $_selectedMunicipalityId');
      */

      final errorMessage = await createUserAndProfile(
          email,
          password,
          firstName,
          lastName,
          middleName,
          _accountType!,
          empId,
          _selectedRegionId,
          _selectedProvinceId,
          _selectedMunicipalityId);

      // Handle successful signup or potential errors
      // (e.g., show a success message or handle signup errors)
      _errorMessage.value = errorMessage;
    }
  }

I have tried to check if the values being passed to function are correct (the commented part above) and they are correct. When I tried to submit, the error message was “AuthRetryableFetchError”. The user is not being inserted in the auth.users table and consequently in the profiles table. How can I debug what is wrong with my code, or did I miss some configuration for Supabase?

I tried using CoPilot and Gemini but both have generic answers that there may be a temporary network disruption or problem with the server. However, I am using a self-hosted Supabase using Docker and I had no trouble during the login process in my Web Application which uses the Supabase Auth.

Here is the schema of my profiles data:

CREATE TABLE profiles (
    id UUID REFERENCES auth.users NOT NULL PRIMARY KEY,
    updated_at TIMESTAMP with time zone,
    lastname VARCHAR(30) NOT NULL,
    firstname VARCHAR(30) NOT NULL,
    middlename VARCHAR(30),
    account_type VARCHAR(20) NOT NULL,
    employee_id VARCHAR(30),
    region_id INT REFERENCES regions(id),
    province_id INT REFERENCES provinces(id),
    municipality_id INT REFERENCES municipalities(id)
);

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật