apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.88k stars 728 forks source link

Queries fails with missingValue error all time after Apollo migration to 1.x version #2975

Closed serbancoroiu closed 1 year ago

serbancoroiu commented 1 year ago

Question

I am trying to update the Apollo dependency for one of my projects from 0.53.0 to 1.x and I have some issues with it. For schema management and code generation I have used apollo-ios-cli.

After updating my classes to fix some errors generated by different type names or missing ApolloAPI import the project is building & running again, but each time when I'm calling any query it ends up with the following error:

GraphQLExecutionError(path: __typename, underlying: ApolloAPI.JSONDecodingError.missingValue)

After I've looked into it a bit deeper, I've found that backend is returning data as needed but the app throws an error in the JSONResponseParsingInterceptor, on the parseResult method. No matter what type of cachePolicy I'm using, it always throws an error from both parseResult and parseResultFast` methods.

Query example:

query GetAppConfigs {
  result: app_config {
        key
    value
    type
  }
}

Any idea?

florianschulz commented 1 year ago

Seeing the same issue after updating from 1.0.5 to 1.1.2 (ApolloAPI.JSONDecodingError.missingValue) for all queries.

nickradford commented 1 year ago

Had same issue here, downgrading to 1.0.5 resolved the issue.

calvincestari commented 1 year ago

We've got @BobaFetters actively looking into this issue, we'll update as soon as we know more - thanks.

BobaFetters commented 1 year ago

The fix for this has been merged into main and will go out with the next release

psdevss commented 1 year ago

The fix for this has been merged into main and will go out with the next release

Hi, good day. Tried it in 1.3, in what version is it fix. Thanks!

BobaFetters commented 1 year ago

@psdevss This was fixed in the 1.1.3 release

psdevss commented 1 year ago

Ahh quick question, why in my query and generating. typename is always there for every object. Actually trying it in our mockserver and json response works if typename is added on each object

BobaFetters commented 1 year ago

@psdevss not 100% clear what you are asking, this issue and #2955 were caused by __typename being added to root field types when using custom names for the root fields (Query, Mutation, Subscription), other types should have __typename generated for them. If you are experiencing an issue I would recommend opening a new issue and providing detailed information on how to reproduce the issue like in #2955

psdevss commented 1 year ago

@psdevss not 100% clear what you are asking, this issue and #2955 were caused by __typename being added to root field types when using custom names for the root fields (Query, Mutation, Subscription), other types should have __typename generated for them. If you are experiencing an issue I would recommend opening a new issue and providing detailed information on how to reproduce the issue like in #2955

Thanks. https://github.com/apollographql/apollo-ios/issues/3030. Created this question