I am receiving following Error only in google chrome. Other browsers are working fine.
Error: Failed to execute 'postMessage' on 'Window': function (number) {
var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' :...
at ApolloClient.hookLogger [as devToolsHookCb] (
at ApolloClient.js:189
at Object.dispatch (store.js:18)
at QueryManager.webpackJsonp.../../../../apollo-client/core/QueryManager.js.QueryManager.fetchQuery (QueryManager.js:187)
at QueryManager.webpackJsonp.../../../../apollo-client/core/QueryManager.js.QueryManager.startQuery (QueryManager.js:489)
at ObservableQuery.webpackJsonp.../../../../apollo-client/core/ObservableQuery.js.ObservableQuery.setUpQuery (ObservableQuery.js:309)
at ObservableQuery.webpackJsonp.../../../../apollo-client/core/ObservableQuery.js.ObservableQuery.onSubscribe (ObservableQuery.js:261)
at ObservableQuery.subscriberFunction (ObservableQuery.js:35)
at ObservableQuery.webpackJsonp.../../../../apollo-client/util/Observable.js.Observable.subscribe (Observable.js:13)
at ConnectionResolve.webpackJsonp.../../../../../src/app/resolves/connection.resolve.ts.ConnectionResolve.getBranchInvoices (connection.resolve.ts:114)
Same here. I am using Apollo developer tool on my Chrome.
Apollo Client - 1.4.2
react-apollo - 1.4.2
It's working fine and all of a sudden getting this error message very often.
Any help would be really appreciated.
My query string
query events($from: Date!, $to: Date!) {...}
In my case the problem was that i was passing date (Moment) object in variables of watchQuery.
client.watchQuery({
query: eventsQuery,
variables: { from, to }
});
I changed that to string using moment.format() and then everything started to work.
client.watchQuery({
query: eventQuery,
variables: { from: from.format("YYYY-MM-DD"), to: to.format("YYYY-MM-DD") }
});
I don't know why it was causing error just in chrome.
I think this is an issue with the new release of the Chrome devtools, cc @ramyanaga
Weird that sending those as JSON over the network doesn't cause an issue, but sending them over postMessage
to the devtools causes problems.
I opened an issue on the dev tools about it: https://github.com/apollographql/apollo-client-devtools/issues/58
@sudharsan1988 @abubakkarbutt Are the two of you also running into this issue with queries with date objects? If not, could you guys specify the type of object you are running into this issue with (if you know the type/can easily figure that info out). Thanks!
@sudharsan1988 @abubakkarbutt can you guys post reproductions of your app/link us to your repos so we can better solve this issue?
In my case, this happened because I was passing a Moment object to Apollo. Fixed it by passing the date object like this: momentDate.toISOString()
A Moment object looks like this:
Closing in favor of the devtools issue! Thank you for the report!
Same as @savovs for me - I was using a moment object, appending .toISOString()
to the value I was passing fixed the error.
Most helpful comment
In my case, this happened because I was passing a Moment object to Apollo. Fixed it by passing the date object like this:
momentDate.toISOString()
A Moment object looks like this:
