-
Notifications
You must be signed in to change notification settings - Fork 787
GraphQL query throws 'QueryKeyMaker cannot handle circular query structures' with simple React Native setup #2442
Comments
same here |
I have the same, the error goes away when I enable Remote JS Debugging. Version |
@sammccord @radiegtya @FabioVerge We are experiencing the same issue too. Are you guys using Everything was working fine 3 days ago. Then today if I clean the repo ( Version |
@SMJ93 I am, the minimum setup to reproduce uses this package-lock: https://github.com/sammccord/QueryKeyMaker-issue-repo/blob/master/package-lock.json |
@SMJ93 We are using .lock files, but we had encountered a problem that required use to clean everything (including lock files), thereafter this problem arose. |
@FabioVerge hmmmmm looks like that could be the issue. I had a similar issue a few months back where Metro released a breaking change as a minor release which broke everything. It looks like a dependency in the tree has been updated which doesn't support React Native Android 🙁 |
Same setup here. |
@sammccord did you run |
@kasstorr does it work for you in Android debug mode? Also where does it mention |
|
@Kasstorr Good spot! That package was also published 3 days ago: |
Setting the version in our package.json fixed the issue:
|
For me the error popped out moving to "apollo-cache-inmemory": "^1.2.10",
"apollo-client": "^2.4.2",
"apollo-link-http": "^1.5.5", |
Nice 👍 Looks like the latest version of |
This should help with github.com/apollographql/react-apollo/issues/2442, as long as the known properties of query document nodes do not participate in cycles.
Please try the latest version of npm install apollo-cache-inmemory@next Specifically, the As a side note, I was not actually able to reproduce the problem (though I very much appreciate the runnable reproduction!), so it would be very helpful if anyone can shed some light on the circular references in question. Are they present in the AST document returned by the There's definitely more that we can do here to tolerate/prevent circular references; it's just a matter of diagnosing the underlying causes and weighing possible solutions. |
Cheers @benjamn. Just bumped into this on a new app that we have and I am now getting the error below (like most folks above crashes on Android but not on iOS). It looks like the issue comes from the facebook Map.js polyfill when we are trying to |
Like most other folks downgrading to |
@benjamn Thanks for looking into this. |
As explained here, with astonishing honesty: https://github.com/facebook/react-native/blob/98a6f19d7c41e1d4fd3c04d07bb2c4e627f21724/Libraries/vendor/core/Map.js#L44-L50 As reported most recently here: apollographql/react-apollo#2442 (comment) For the record, I have previously complained that these polyfills are simply buggy and should be replaced: #3394 (comment) While that is still true, this workaround should moot the debate. 🐮
As explained here, with astonishing honesty: https://github.com/facebook/react-native/blob/98a6f19d7c41e1d4fd3c04d07bb2c4e627f21724/Libraries/vendor/core/Map.js#L44-L50 As reported most recently here: apollographql/react-apollo#2442 (comment) For the record, I have previously complained that these polyfills are simply buggy and should be replaced: #3394 (comment) While that is still true, this workaround should moot the debate. 🐮
@gabceb While I still find it astonishing that the authors of the React Native Try it out in |
@sammccord Any chance you can connect a debugger to your repro app and set some breakpoints in the |
@benjamn 1.3.4 puts me back on circular QueryKeyMaker. See the output for the value:{
"selectionSet": {
"selections": [
{
"directives": [],
"arguments": [],
"name": {
"value": "timesheetId",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "employerId",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "weekEnding",
"kind": "Name"
},
"kind": "Field"
},
{
"selectionSet": {
"selections": [
{
"directives": [],
"arguments": [],
"name": {
"value": "fullName",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "avatarUrl",
"kind": "Name"
},
"kind": "Field"
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "__typename"
}
}
],
"kind": "SelectionSet"
},
"directives": [],
"arguments": [],
"name": {
"value": "contact",
"kind": "Name"
},
"kind": "Field"
},
{
"selectionSet": {
"selections": [
{
"directives": [],
"arguments": [],
"name": {
"value": "shiftId",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "forecastCharge",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "jobTitle",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "name",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "timeRange",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "startDate",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "endDate",
"kind": "Name"
},
"kind": "Field"
},
{
"selectionSet": {
"selections": [
{
"directives": [],
"arguments": [],
"name": {
"value": "type",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "date",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "comment",
"kind": "Name"
},
"kind": "Field"
},
{
"selectionSet": {
"selections": [
{
"directives": [],
"arguments": [],
"name": {
"value": "fullName",
"kind": "Name"
},
"kind": "Field"
},
{
"directives": [],
"arguments": [],
"name": {
"value": "tesUserId",
"kind": "Name"
},
"kind": "Field"
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "__typename"
}
}
],
"kind": "SelectionSet"
},
"directives": [],
"arguments": [],
"name": {
"value": "user",
"kind": "Name"
},
"kind": "Field"
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "__typename"
}
}
],
"kind": "SelectionSet"
},
"directives": [],
"arguments": [],
"name": {
"value": "events",
"kind": "Name"
},
"kind": "Field"
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "__typename"
}
}
],
"kind": "SelectionSet"
},
"directives": [],
"arguments": [],
"name": {
"value": "shifts",
"kind": "Name"
},
"kind": "Field"
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "__typename"
}
}
],
"kind": "SelectionSet"
},
"directives": [],
"arguments": [
{
"value": {
"name": {
"value": "employerId",
"kind": "Name"
},
"kind": "Variable"
},
"name": {
"value": "employerId",
"kind": "Name"
},
"kind": "Argument"
}
],
"name": {
"value": "listCurrentTimesheets",
"kind": "Name"
},
"kind": "Field"
} cached:{} |
@gabceb Thanks! That expansion of What happens if you try The |
@benjamn |
Interesting! So there don't appear to be any circular references that are visible to A couple more questions:
|
Re: your first question, I am running on a Android simulator on dev which means the js will actually be bundled on the machine using node but executed on the device using whatever js runtime. Yesterday I did see the non-extensible issue on a device running a prod build but have not tried on this new version. Looking into your second question. |
@benjamn See https://gist.github.com/gabceb/7a33b0769d05cfffa1a4941d07c81e91 for all the PerQueryKeyMaker.prototype.lookupObject = function (object) {
var _this = this;
var keys = safeSortedKeys(object);
var values = keys.map(function (key) {
console.log("KEY", key);
return _this.lookupAny(object[key]);
});
return this.cacheKeyRoot.lookup(Object.getPrototypeOf(object), this.cacheKeyRoot.lookupArray(keys), this.cacheKeyRoot.lookupArray(values));
}; Note that there is a single |
got rid of apollo-boost and moved to single packages although the |
@thegreatgabsby This issue refers to code added in As a more general note, |
We were running into this issue as everyone else but downgrading to Found out this was caused because we were still using
|
@benjamn I upped to 1.3.4 to try and fix the circular query structures issue. No luck. Anything I can give you to help diagnose? Notes: Happens on device in release. Happens on android emulator. Does not happen on android emulator with debugging on. |
Exciting news! This issue turned out to be due to some unfortunate bugs in the React Native In other words, this is entirely not my fault, and instead the result of folks rolling their own implementation of the ECMAScript If I'm being honest: I'm not feeling so great right now about the profession we've chosen. How does software even work, like, ever, at all? |
Who says software works? I guess you didnt know is just a bunch of leprechauns showing things on screens 😁 Awesome work @benjamn 👏🏻 |
This prevents strange bugs like this one: apollographql/react-apollo#2442
Ok, if you update to |
Thanks @benjamn great work 👏 |
This prevents strange bugs like this one: apollographql/react-apollo#2442
I spun up a new expo app with
expo init
, added requisite React/GraphQL dependencies, and was greeted with this fun, unshakable error:whenever any
<Query />
component is mounted.Intended outcome:
I was attempting to query a public graphql endpoint from a simple
react-native
app, and see either data or a network error with the following dependencies.package.json
dependenciesActual outcome:
The app compiles, and throws immediately with the following stack trace:
How to reproduce the issue:
I've published a minimal example app that crashes with the same error when pointed at a public graphql endpoint. Here's the github repo, with instructions on how to reproduce locally.
It's occuring constantly on my OnePlus 6, with Android 9 Pie. Can't test on iOS (on linux), but would love to know if that happens there as well.
Version
The text was updated successfully, but these errors were encountered: