Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute 'postMessage' on 'window'. #1871

Closed
muhammad-abubakkar opened this issue Jul 9, 2017 · 10 comments
Closed

Failed to execute 'postMessage' on 'window'. #1871

muhammad-abubakkar opened this issue Jul 9, 2017 · 10 comments

Comments

@muhammad-abubakkar
Copy link

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' :...... } could not be cloned.
at ApolloClient.hookLogger [as devToolsHookCb] (:13:12)
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)

@sudharsan1988
Copy link

sudharsan1988 commented Jul 9, 2017

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.

@muhammad-abubakkar
Copy link
Author

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.

@stubailo
Copy link
Contributor

stubailo commented Jul 9, 2017

I think this is an issue with the new release of the Chrome devtools, cc @ramyanaga

@stubailo
Copy link
Contributor

stubailo commented Jul 9, 2017

Weird that sending those as JSON over the network doesn't cause an issue, but sending them over postMessage to the devtools causes problems.

@stubailo
Copy link
Contributor

stubailo commented Jul 9, 2017

I opened an issue on the dev tools about it: apollographql/apollo-client-devtools#58

@ramyanaga
Copy link
Contributor

@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!

@ramyanaga
Copy link
Contributor

@sudharsan1988 @abubakkarbutt can you guys post reproductions of your app/link us to your repos so we can better solve this issue?

@vladinator1000
Copy link

vladinator1000 commented Jul 12, 2017

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:
image

@jbaxleyiii
Copy link
Contributor

Closing in favor of the devtools issue! Thank you for the report!

@joelbowen
Copy link

Same as @savovs for me - I was using a moment object, appending .toISOString() to the value I was passing fixed the error.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants