Skip to content

MultipartResponseParsingInterceptor.ParsingError.cannotParseResponse #3536

Closed
@GRajin

Description

@GRajin

Summary

Hello, There seems to be an issue with parsing the response.

failure(Apollo.MultipartResponseParsingInterceptor.ParsingError.cannotParseResponse)

This happens when trying to use the generated queries during the fetching process.

What works
☑ The installation and setup works good.
☑ Codegen - Downloading schema works good
☑ Codegen - Generating swift code from queries works good

What doesn't work
☒ Failure occurs when implementing the generated queries using ApolloClient

To Note
The implementation perfectly works with the legacy version of the Apollo Client

Version

Tried in version 1.16.0, 1.16.1, 1.17.0, 1.18.0, 1.19.0 and it doesn't work

Steps to reproduce the behavior

These are the steps I implemented.

  1. Created an iOS project in Xcode
  2. Using SPM, installed Apollo package[latest version]
  3. Setup Apollo CLI and generated configuration json file
  4. Using introspection, downloaded the schema from the server in .graphqls format
  5. Added queries for fetching data in .graphql format
  6. Ran code generation to generate as SPM module
  7. Added the module via Swift package manager and linked to the target.
  8. Created a shared ApolloClient for running the query
class Network {
    
    static let shared = Network()
    
    private(set) lazy var apollo = ApolloClient(url: URL(string: "https://countries.trevorblades.com/graphql")!)
}
  1. Error occurs while fetching the response from server
private func fetchContinents() {
    Network.shared.apollo.fetch(query: GetAllContinentsQuery()) { result in
        print(result)
    }
}
  1. failure(Apollo.MultipartResponseParsingInterceptor.ParsingError.cannotParseResponse)

Logs

----- Failure -----
Error Type: ParsingError
Error Description: The response data could not be parsed.
Full Error Object: cannotParseResponse
NSError Domain: Apollo.MultipartResponseParsingInterceptor.ParsingError
NSError Code: 1
NSError UserInfo: [:]
Error handled in fetch completion. Stack trace at this point:
0   World.debug.dylib                   0x00000001058b5d60 $s5World24ContinentsViewControllerC05fetchB033_201A3815233999ABBEA1B7BAF218466ELLyyFys6ResultOy6Apollo13GraphQLResultVy0A9SchemaAPI06GetAllB5QueryC4DataVGs5Error_pGcfU_ + 5424
1   World.debug.dylib                   0x00000001058bd271 $s6Apollo0A6ClientC5fetch5query11cachePolicy17contextIdentifier0G05queue13resultHandlerAA11Cancellable_px_AA05CacheF0O10Foundation4UUIDVSgAA14RequestContext_pSgSo012OS_dispatch_I0Cys6ResultOyAA13GraphQLResultVy4DataQzGs5Error_pGcSgt0A3API0U7QLQueryRzlFyA2_cfU_ + 161
2   World.debug.dylib                   0x00000001059195c4 $s6Apollo23InterceptorRequestChainC16handleErrorAsync_7request8response10completionys0F0_p_AA11HTTPRequestCyxGAA12HTTPResponseCyxGSgys6ResultOyAA13GraphQLResultVy4DataQzGsAH_pGct0A3API0N11QLOperationRzlFyyYbcfU_ + 372
3   World.debug.dylib                   0x00000001058be1f8 $sIegh_IeyBh_TR + 40
4   libdispatch.dylib                   0x0000000104b93a6d _dispatch_call_block_and_release + 12
5   libdispatch.dylib                   0x0000000104b94df6 _dispatch_client_callout + 8
6   libdispatch.dylib                   0x0000000104ba4cad _dispatch_main_queue_drain + 1361
7   libdispatch.dylib                   0x0000000104ba474e _dispatch_main_queue_callback_4CF + 31
8   CoreFoundation                      0x00007ff80042f4b5 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9   CoreFoundation                      0x00007ff800429c05 __CFRunLoopRun + 2515
10  CoreFoundation                      0x00007ff800428df1 CFRunLoopRunSpecific + 550
11  GraphicsServices                    0x00007ff811d420cb GSEventRunModal + 137
12  UIKitCore                           0x00007ff8064acf68 -[UIApplication _run] + 875
13  UIKitCore                           0x00007ff8064b1ea9 UIApplicationMain + 123
14  UIKitCore                           0x00007ff805418793 block_destroy_helper.22 + 9747
15  World.debug.dylib                   0x00000001058b3efb $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 123
16  World.debug.dylib                   0x00000001058b3e77 $s5World11AppDelegateC5$mainyyFZ + 39
17  World.debug.dylib                   0x00000001058b3f68 __debug_main_executable_dylib_entry_point + 24
18  dyld                                0x0000000104c38478 start_sim + 10
19  ???                                 0x000000010618e2cd 0x0 + 4397261517
-------------------------------

Anything else?

There is an issue tracker opened in the Developer Forums but no relevant comments or response is available
https://developer.apple.com/forums/thread/777939

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions