Skip to content

GraphQL Logout mutation w/o X-Parse-Session-Token header causes internal server error #7027

Closed
@MichaelJCole

Description

@MichaelJCole

New Issue Checklist

Issue Description

Performing the logout mutation from the documentation, without a session set in the headers, causes the following internal server error:

error: Uncaught internal server error. Cannot read property 'id' of undefined {"stack":"TypeError: Cannot read property 'id' of undefined
    at mutateAndGetPayload (/app/node_modules/parse-server/lib/GraphQL/loaders/usersMutations.js:231:122)
    at resolve (/app/node_modules/graphql-relay/lib/mutation/mutation.js:88:30)
    at field.resolve (/app/node_modules/graphql-extensions/dist/index.js:134:26)
    at field.resolve (/app/node_modules/apollo-server-core/dist/utils/schemaInstrumentation.js:52:26)
    at resolveFieldValueOrError (/app/node_modules/graphql/execution/execute.js:467:18)
    at resolveField (/app/node_modules/graphql/execution/execute.js:434:16)
    at /app/node_modules/graphql/execution/execute.js:244:18
    at /app/node_modules/graphql/jsutils/promiseReduce.js:23:10
    at Array.reduce (<anonymous>)
    at promiseReduce (/app/node_modules/graphql/jsutils/promiseReduce.js:20:17)"}

The throwing code seems to be here.

Steps to reproduce

  1. Open the playground
  2. Clear session header
  3. Run the logout mutation from the docs:
mutation logOut {
        logOut(input: { clientMutationId: "logOut" }) {
          clientMutationId
          viewer {
            user {
              username
              email
            }
          }
        }
      }

Actual Outcome

Error message above

Expected Outcome

Logging out, without a session token should 400, or return empty user data. I don't think it should log or print a stack trace.

Environment

Server side:
"resolutions": {
"graphql": "^14.7.0"
},
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"graphql": "^14.7.0",
"graphql-tag": "^2.11.0",
"nodemon": "^2.0.6",
"parse-server": "^4.4.0"
}

Server

  • Parse Server version: 4.4.0
  • Operating system: Ubuntu 20.04
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: mongodb-runner start
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): JavaScript
  • SDK version: https://apollo.vuejs.org/

Logs

See error above. VERBOSE=1 didn't show more stuff.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions