Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the
official AWS AppSync forum
Do you want to request a feature or report a bug?
bug
What is the current behavior?
undefined is not an object (evaluating '_reactNative.NetInfo.getConnectionInfo')
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
It is due to improper redux-offline package.
@redux-offline/redux-offline/lib/defaults/detectNetwork.native.legacy.js
var isLegacy = typeof _reactNative.NetInfo.getConnectionInfo === 'undefined';
What is the expected behavior?
Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions?
Same. I am getting : Cannot read property 'getConnectionInfo' of undefined
after doing
import AWSAppSyncClient from 'aws-appsync'
redux-offline maintainers working towards a fix on their end
Some more on this
My team forked redux-offline and fixed the NetInfo issue, but we still run into problems with aws-appsync-react inside of "lib/rehydrated-rn.js"
During rehydration we get the error: "TypeError: Cannot read property 'isConnected' of undefined"
line 81: react_native_1.NetInfo.isConnected.fetch()
Any news on this ?
Seems like this PR https://github.com/awslabs/aws-mobile-appsync-sdk-js/pull/437 + patching redux-offline are fixing this issue.
How to apply this PR until, the owners merge the fix?
Any update on officially release date of a fix for this issue?
Updated posted at https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/443#issuecomment-516140486
I found a way around it. I forked https://github.com/awslabs/aws-mobile-appsync-sdk-js, then, as this is a mono repo for 2 packages, I created a git repo for each (if someone knows a more elegant solution I'd be happy to hear it), updated dep "@redux-offline/redux-offline": "^2.5.2-native.0", added dep "@react-native-community/netinfo": "^4.1.4" and calls to NetInfo, then in my project I use references to those 2 repos + required ""@react-native-community/netinfo": "^4.1.4"" and linked it :
"dependencies": {
"@react-native-community/netinfo": "^4.1.4",
"aws-appsync": "https://github.com/badaz/aws-appsync#master",
"aws-appsync-react": "https://github.com/badaz/aws-appsync-react#master",
[...]
Ideally @redux-offline/redux-offline and react-native-community/netinfo should be peer and dev deps in aws packages
Hi,
We have just released an unstable version that addresses this issue. More details here: https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/443#issuecomment-519310531
Closing this issue as AWS AppSync SDK v2.00 has been released, which supports RN 0.60 and the documentation has been updated as well.
Still getting this error :
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module @react-native-community/netinfo from node_modules\aws-appsync-react\lib\rehydrated-rn.js: @react-native-community/netinfo could not be found within the project.
OS: windows 10
"dependencies": {
"aws-amplify": "^2.2.2",
"aws-amplify-react-native": "^3.2.0",
"aws-appsync": "^3.0.2",
"aws-appsync-react": "^3.0.2",
"graphql-tag": "^2.10.1",
"react": "16.9.0",
"react-apollo": "^3.1.3",
"react-native": "0.61.5"
},
Still getting this error :
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module@react-native-community/netinfofromnode_modules\aws-appsync-react\lib\rehydrated-rn.js: @react-native-community/netinfo could not be found within the project.OS: windows 10
"dependencies": {
"aws-amplify": "^2.2.2",
"aws-amplify-react-native": "^3.2.0",
"aws-appsync": "^3.0.2",
"aws-appsync-react": "^3.0.2",
"graphql-tag": "^2.10.1",
"react": "16.9.0",
"react-apollo": "^3.1.3",
"react-native": "0.61.5"
},
ok, sorry. I had to explicitly install @react-native-community/netinfo . This problem is gone.
Most helpful comment
How to apply this PR until, the owners merge the fix?