Home > Net >  I Got This Error -> Receive 500 error. in Swift GraphQL
I Got This Error -> Receive 500 error. in Swift GraphQL

Time:10-18

When i fetch query then i get this error

Error Result -> Received a 500 error. Data returned as a String was: {"errors":[{"message":"Context creation failed: Authorization failed"}]}

Here is my Query.

// File Name Queries.graphql 
query SendOTP($phoneNumber: String!) {
  sendOtp(phoneNumber: $phoneNumber) {
    __typename
    status
  }
}

here is my API call.

Network.shared.apollo.fetch(query: SendOtpQuery(phoneNumber: "84595XXXXX")) { result in
        switch result {
        case .success(let graphQLResult):
            print(graphQLResult)
        case .failure(let error):
            print("Error Result -> \(error.localizedDescription)")
        }
    }

CodePudding user response:

Hmmmmmm.

I think your query looks nice and your API Call is nice.

And GraphQL API is an auto-generated file. I am sure your API.swift file good.


my suggestion is, please connect your API backend team and discuss this problem.

all things are good on your end ok don’t worry. About that.

CodePudding user response:

seems connection failure (no Authorization) between api and code.

  • Related