When trying to run the app after upgrading to Apollo 1.0.7 I am getting this run time error and was trying to figure out what this means. I know that the WebSocketTransport setup stuff changed. I will be looking at the docs today but wanted to see if anyone had a general idea to look for this kind of error. thanks!
Hi @geeksweep
When trying to run the app after upgrading to Apollo 1.0.7
Are you upgrading from an earlier 1.x version of from a much older 0.x version?
I am getting this run time error and was trying to figure out what this means. I know that the WebSocketTransport setup stuff changed.
That error is related to the HTTP side of networking, so nothing done to WebSockets should be contributing to the error. You can find the error here, and it’s most likely being caused by the sequence of the interceptors. Are you supplying a custom list of interceptors to the transport?
upgrading from 0.x version.
here is what we have now:
RetryInterceptor(),// max retry
NetworkRetryInterceptor(), // sets self as additionalErrorHandler
PreFlightInterceptor(), // set headers
AssignRequestIdInterceptor(), // add X-Request-Id
PreFlightLoggingInterceptor(), // log
PreFlightLoadingInterceptor(), // ui spinner
NetworkFetchInterceptor(client: self.client), // network request
// post flight
PostFlightLoggingInterceptor(), // log
PostFlightLoadingInterceptor(), // ui spinner
InvalidResponseCodeInterceptor(), // response code
//AutomaticPersistedQueryInterceptor(), // this is turned off so commenting this out
ResponseErrorInterceptor(), // handles response errors
ResponseHeaderInterceptor(), // checks feature flags and X-Request-Id
do i still need to add some of the default ones in the current list … ? i.e. JSONResponseParsing? Just looking at the default chain from the docs:
Does one of the interceptors need to return returnValueAsync or that not required?
so it turns out i had to add the JSONResponseParsingInterceptor() to the list like here:
RetryInterceptor(),// max retry
NetworkRetryInterceptor(), // sets self as additionalErrorHandler
PreFlightInterceptor(), // set headers
AssignRequestIdInterceptor(), // add X-Request-Id
PreFlightLoggingInterceptor(), // log
PreFlightLoadingInterceptor(), // ui spinner
NetworkFetchInterceptor(client: self.client), // network request
JSONResponseParsingInterceptor(),
// post flight
PostFlightLoggingInterceptor(), // log
PostFlightLoadingInterceptor(), // ui spinner
InvalidResponseCodeInterceptor(), // response code
//AutomaticPersistedQueryInterceptor(), // this is turned off so commenting this out
ResponseErrorInterceptor(), // handles response errors
ResponseHeaderInterceptor(), // checks feature flags and X-Request-Id
No idea why that worked. I didn’t see anything in the upgrade docs about that, that I recall.
Thanks for following up here @geeksweep. It is correct that you need JSONResponseParsingInterceptor
in the interceptor chain. It’s odd that it wouldn’t have been required in an earlier 1.x version. Glad it is now working for you.
yeah it was working in an earlier version, I think it was 0.40.