PalisadoesFoundation / talawa

Community Organization Management Software. Click on the link below to see our documentation.
https://docs.talawa.io/
GNU General Public License v3.0
306 stars 434 forks source link

Bug Report: SignUp (Mobile) #2454

Closed ArinNigam closed 2 months ago

ArinNigam commented 3 months ago

Describe the bug

The Talawa App is not able to run locally because of certain GrapphQL errors on the client side

image

On server Talawa-API userRegistrationRequired is not defined for the type Organizations in types.ts

image

During Login there is a GraphQL error

image

image image

To Reproduce Steps to reproduce the behavior:

  1. Fix Login by taking care of appUserProfile
  2. Fix Sign Up by taking care of userRegistrationRequired

Expected behavior Run Talawa Mobile successfully without any errors.

Actual behavior

Additional details I'll create an issue in Talawa-API to add the particular fields described in screenshot in types.ts

Potential internship candidates Please read this if you are planning to apply for a Palisadoes Foundation internship https://github.com/PalisadoesFoundation/talawa/issues/359

ArinNigam commented 3 months ago

I would like to work on this issue

Cioppolo14 commented 3 months ago

@ArinNigam Before working on this, please verify this issue is happening in the develop march. Please close this if it is not needed.

ArinNigam commented 3 months ago

The error is being caused by userRegistrationRequired. The server issue has been closed. Apparently the fields are present in develop branch and I mistook main branch as the develop

Though the issue with SignUp and Login still exist at client side:

GraphQLError(message: Cannot return null for non-nullable field Organization.userRegistrationRequired.

https://github.com/PalisadoesFoundation/talawa/assets/99138286/6d4868f1-e038-488d-bc5a-82bac1e9ec56

https://github.com/PalisadoesFoundation/talawa/assets/99138286/8744bc46-9161-4974-b325-879e84ac153e

ArinNigam commented 2 months ago

Hi, just checked that sample imports were old in my databases and were causing issues for login and signup where it was giving userRegistrationRequired to be null since it was not defined in the database initially.

https://github.com/PalisadoesFoundation/talawa/assets/99138286/5f762c5d-159c-4ee1-911f-5a507768a771

https://github.com/PalisadoesFoundation/talawa/assets/99138286/ea985977-9abc-4b90-9b45-e8889be22c42

Login works perfectly fine. But still there is an issue persists with signup which is most probably be caused from the server side. Attaching the logs

This is when you click on signup after filling all the details

From Server

error Field "UserInput.selectedOrganization" of required type "ID!" was not provided. {
"locations": [
    {
        "line": 3,
        "column": 16
    }
],
"extensions": {
    "code": "GRAPHQL_VALIDATION_FAILED",
     "stacktrace": [
        "GraphQLError: Field \"UserInput.selectedOrganization\" of required type \"ID!\" was not provided.",
        "    at Object.ObjectValue (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js:64:13)",
        "    at Object.enter (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/graphql/language/visitor.js:301:32)",
        "    at Object.enter (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/graphql/utilities/TypeInfo.js:391:27)",
        "    at visit (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/graphql/language/visitor.js:197:21)",
        "    at validate (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/graphql/validation/validate.js:91:24)",
        "    at processGraphQLRequest (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/@apollo/server/src/requestPipeline.ts:247:40)",
        "    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",
        "    at internalExecuteOperation (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/@apollo/server/src/ApolloServer.ts:1313:12)",
        "    at runHttpQuery (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/@apollo/server/src/runHttpQuery.ts:232:27)",
        "    at runPotentiallyBatchedHttpQuery (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/@apollo/server/src/httpBatching.ts:85:12)",
        "    at ApolloServer.executeHTTPGraphQLRequest (/Users/arinnigam/Desktop/AppDev/talawa/talawa-api/node_modules/@apollo/server/src/ApolloServer.ts:1087:14)"
    ]
}
}

From Client

I/flutter (17501): ServerException(
  originalException: null, 
  originalStackTrace: null, 
  parsedResponse: 
    Response
      (data: null,
      errors: [GraphQLError(message: Field "UserInput.selectedOrganization" of required type "ID!" was not provided.,
      locations: null, path: null, extensions: null)],
      context: Context({ResponseExtensions: Instance of 'ResponseExtensions'}), 
      response: {
        errors: [{message: Field "UserInput.selectedOrganization" of required type "ID!" was not provided.,
        status: GRAPHQL_VALIDATION_FAILED,
        data: []}]}
      ))

The current issue persists for SignUp page which is most probably is being caused from the server side. I would like to know to if there is any existing issue in talawa-api who are working on this thing or should I link this issue and create one on talawa-api.


I am not closing this issue since there still persists an issue with signup on the mobile app. Once it gets solved on the backend side. I'll close this issue.

Azad99-9 commented 2 months ago

Hey @ArinNigam I appreciate you efforts for finding out these bugs.

The login flow is working without any errors in the latest upstream.

For the signup part, after making the required changes to the mutation locally and fixing some minor bugs in the backend it's working fine. Which I will push into the select organization issue's #2330 PR. backend signup bug https://github.com/PalisadoesFoundation/talawa-api/issues/2203

So I guess the bugs related to login and signup will be fixed.

Login https://github.com/PalisadoesFoundation/talawa/assets/120930148/4c961662-3ceb-4483-9d77-edee87572a64

Signup https://github.com/PalisadoesFoundation/talawa/assets/120930148/9fdb4ca6-bb33-4a16-b0be-8a340ede92f7

Currently logout feature is not working as expected. Probably you can raise an issue for that and start working on it.

ArinNigam commented 2 months ago

Hi, @Azad99-9

Yeah the backend issue needs to be solved for making the signup work.

I also made some changes locally on the client side and signup is working fine for me. Though some tests files are failing due to which I am not raising any PR. If you have any insights regarding how to fix unit tests that you can give?

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure was thrown running a test:
No matching calls. All calls: MockDataBaseMutationFunctions.init(),
MockDataBaseMutationFunctions.gqlNonAuthMutation(
    '        mutation{
              signUp(data: {firstName: "", lastName: "", email: "", password: "",
selectedOrganization: "3"})
              {
                appUserProfile{
                  adminFor{
                    _id
                    name
                  }
                  createdOrganizations{
                    _id
                    name
                    image
                    description
                    userRegistrationRequired
                    creator{
                      _id
                      firstName
                      lastName
                      image
                    }
                  }
                }
                user{
                    _id
                    firstName
                    lastName
                    email
                    image
                    joinedOrganizations{
                      _id
                      name
                      image
                      description
                      userRegistrationRequired
                      creator{
                        _id
                        firstName
                        lastName
                        image
                      }
                    }
                    membershipRequests{
                      organization{
                        _id
                        name
                        image
                        description
                        userRegistrationRequired
                        creator{
                          _id
                          firstName
                          lastName
                          image
                        }
                      }
                    }
                  }
                  refreshToken
                  accessToken
                }
            }
        ', {variables: null, reCall: true})
(If you called `verify(...).called(0);`, please instead use `verifyNever(...);`.)

When the exception was thrown, this was the stack:
#0      fail (package:matcher/src/expect/expect.dart:149:31)
#1      _VerifyCall._checkWith (package:mockito/src/mock.dart:797:7)
#2      _makeVerify.<anonymous closure> (package:mockito/src/mock.dart:1071:18)
#3      main.<anonymous closure>.<anonymous closure> (file:///Users/arinnigam/Desktop/AppDev/talawa/talawa/test/view_model_tests/pre_auth_view_models/signup_details_view_model_test.dart:116:13)
<asynchronous suspension>
#4      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:183:15)
<asynchronous suspension>
#5      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1017:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)

The test description was:
  Check if signup() is working fine when selected organization is not empty and public
════════════════════════════════════════════════════════════════════════════════════════════════════

https://github.com/PalisadoesFoundation/talawa/assets/99138286/01b6e185-a7b6-4106-8c33-09c4dadb274b

Azad99-9 commented 2 months ago

Please share me the code of test case which you are working on.

ArinNigam commented 2 months ago

Please share me the code of test case which you are working on.

Here 6 test cases fails in sign_up_details_view_model_test.dart

image
GlenDsza commented 2 months ago

@ArinNigam @Azad99-9 isn't this issue (linked PR) and #2330 the same?

Azad99-9 commented 2 months ago

@palisadoes @GlenDsza No this issue's PR and the issue #2330 are not same. But yes this issue is a prerequisite for the issue #2330.

@palisadoes kindly reopen #2330 as still there is a significant amount of work pending to make the membershipRequest flow work as expected. Moreover the current request flow is highly bug prone.

Recording of current organization request flow.

https://github.com/PalisadoesFoundation/talawa/assets/120930148/5672a719-67ad-470b-abf2-3af7b82dfe6e

The issues are

  1. The application is prompting that the membership request already exist even if its the first time to register.
  2. The request sent to the org is not properly being stored in the database leading to not showing the user's request in admin portal.

These both issues are related to Mobile client and needs to be fixed.

palisadoes commented 2 months ago

2330 is already reopened

Azad99-9 commented 2 months ago

@palisadoes my bad, I am sorry for the confusion. My intention was to answer to @GlenDsza 's question and to convey that #2330 is a bigger problem.

This prerequisite issue can be closed as it solves the sign up bug.