aws-mobile-appsync-sdk-js: apollo_cache_inmemory_1.readQueryFromStore is not a function in browser

Do you want to request a feature or report a bug? bug

What is the current behavior? I’m receiving an error message when trying to process an offline query

ERROR Error: Network error: apollo_cache_inmemory_1.readQueryFromStore is not a function
    at new ApolloError (ApolloError.js:37)
    at QueryManager.js:335
    at QueryManager.js:710
    at Array.forEach (<anonymous>)
    at QueryManager.js:709
    at Map.forEach (<anonymous>)
    at QueryManager.push../node_modules/aws-appsync/node_modules/apollo-client/core/QueryManager.js.QueryManager.broadcastQueries (QueryManager.js:704)
    at QueryManager.js:284
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388)
    at Object.onInvoke (core.js:3824)

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. It happens from time to time, only when a query is executed and the store is offline, well, only when my code reaches method processOfflineQuery.

What is the expected behavior? Process the query.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions? I’m using, in a angular app in browser (chrome):

    "apollo-angular": "^1.5.0",
    "apollo-angular-link-http": "^1.4.0",
    "apollo-cache-inmemory": "^1.3.9",
    "apollo-client": "^2.4.3",
    "apollo-link-error": "^1.1.1",    
    "aws-appsync": "^1.4.0",

The store should be hydrated since I do it in app startup.

Thank you

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 16 (5 by maintainers)

Most upvoted comments

@jamesalexmorgan @e23z @luccamordente @iudelsmann

We just published a new version to npm, could you guys test with these:

  • aws-appsync-react@1.2.1
  • aws-appsync@1.5.0

No more errors for me. Thank you very much!

You’re fast! Thanks for that.

Same as @e23z here. Same replication steps as well.

I’ve just updated to these versions: aws-appsync-react@1.2.2 aws-appsync@1.5.1

@manueliglesias Thanks a lot! You guys are amazing! The issue is completely gone. πŸ˜„

The only problem I am facing now is this:

Error: Network error: Can't find field listPostTypes({"limit":10}) on object undefined.
ApolloError β€” ApolloError.js:58
(anonymous function) β€” QueryManager.js:522
(anonymous function) β€” QueryManager.js:982
forEach
(anonymous function) β€” QueryManager.js:981
forEach
broadcastQueries β€” QueryManager.js:977
(anonymous function) β€” QueryManager.js:477
promiseReactionJob

But it’s probably some mistake I’ve made or something I misconfigured. And a simple setTimeout workaround to delay my query fixed the problem anyway.

@manueliglesias Can’t replicate the issue anymore!!! πŸ˜† πŸŽ‰ πŸ˜† πŸŽ‰ πŸ˜† πŸŽ‰ πŸ˜† πŸŽ‰ You guys are awesome!!

I’m seeing pretty much this exact behavior in a react-native app as well. Using the demo app from here: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-reactnative.html. It appears the error is thrown but the query is still executed against the offline cache and returning results.