"[object Object],[object Object] is not iterable!" for AuthSession.startAsync on Android

SOLVED! See this chain/comment: https://github.com/facebook/react-native/issues/15902#issuecomment-375521246

Add these imports at the entrypoint of your app.

// symbol polyfills
global.Symbol = require('core-js/es6/symbol');
require('core-js/fn/symbol/iterator');

// collection fn polyfills
require('core-js/fn/map');
require('core-js/fn/set');
require('core-js/fn/array/find');

Occurs only on Android, works great on iOS. When I call AuthSession.startAsync it throws this error and crashes the app. I believe it has to do with the forOf call deep below within the: return await Promise.race([openBrowserAsync(startUrl), _waitForRedirectAsync(returnUrl)]); call.

Stack Trace:

[object Object],[object Object] is not iterable!

Stack trace:
  node_modules/core-js/library/modules/_array-includes.js:19:11 in exports
  node_modules/core-js/library/modules/_meta.js:13:29 in <unknown>
  node_modules/core-js/library/modules/core.get-iterator-method.js:1:14 in _perform
  node_modules/core-js/library/modules/_meta.js:13:20 in race
  node_modules/expo/src/WebBrowser.js:66:30 in _openAuthSessionPolyfillAsync$
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:296:30 in invoke
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:28 in invoke
  node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
  node_modules/core-js/library/modules/es6.symbol.js:142:16 in Promise
  node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
  node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:241:8 in async
  node_modules/expo/src/WebBrowser.js:56:0 in _openAuthSessionPolyfillAsync
  node_modules/expo/src/WebBrowser.js:31:41 in openAuthSessionAsync$
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:296:30 in invoke
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:28 in invoke
  node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
  node_modules/core-js/library/modules/es6.symbol.js:142:16 in Promise
  node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
  node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:241:8 in async
  node_modules/expo/src/WebBrowser.js:26:0 in openAuthSessionAsync
  node_modules/expo/src/AuthSession.js:90:53 in _openWebBrowserAsync$
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:296:30 in invoke
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:28 in invoke
  node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
  node_modules/core-js/library/modules/es6.symbol.js:142:16 in Promise
  node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
  node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:241:8 in async
  node_modules/expo/src/AuthSession.js:88:0 in _openWebBrowserAsync
  node_modules/expo/src/AuthSession.js:56:40 in startAsync$
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:296:30 in invoke
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:28 in invoke
  node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
  node_modules/core-js/library/modules/es6.symbol.js:142:16 in Promise
  node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
  node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
  node_modules/regenerator-runtime/runtime.js:114:28 in <unknown>
  node_modules/regenerator-runtime/runtime.js:241:8 in async
  node_modules/expo/src/AuthSession.js:27:0 in startAsync
  src/components/NotificationsModal.js:169:8 in login
  node_modules/react-native/Libraries/Components/Touchable/TouchableNativeFeedback.android.js:175:45 in touchableHandlePress
  node_modules/react-native/Libraries/Components/Touchable/Touchable.js:744:34 in _performSideEffectsForTransition

where is the Promise.race([openBrowserAsync(startUrl), _waitForRedirectAsync(returnUrl)]) code?

for of isn’t supported on Android with the current version of JSC I believe, we’ll update it soon

forOf is used deep within core-js

Line 65 of WebBrowser.js. It’s called in this line of the trace:

  node_modules/core-js/library/modules/_meta.js:13:20 in race
  node_modules/expo/src/WebBrowser.js:66:30 in _openAuthSessionPolyfillAsync$

Hits _openAuthSessionPolyfillAsync because of Android.

here’s an example snack that does the same sort of thing with Promise.race:

works fine on android there. can you share a reproducible example?

fwiw I tried out https://github.com/expo/examples/tree/master/with-facebook-auth just now and it worked as expected on android, so i imagine it’s something in your app code

Thanks for testing those out. I attempted to re-produce an example of it not working to no avail. The code within that part of my app is pretty simple so can’t do much different. I believe there may be some funky conflicts with other libraries I’m working with. Might be something with Babel? Just a gut feeling. Am I using anything ridiculous?

  "dependencies": {
    "@expo/vector-icons": "^6.3.1",
    "@expo/videoplayer": "^0.4.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "babel-preset-expo": "^4.0.0",
    "buffer": "^5.1.0",
    "color": "^3.0.0",
    "expo": "^29.0.0",
    "invariant": "^2.2.4",
    "js-base64": "^2.4.8",
    "lodash": "^4.17.10",
    "moment": "^2.22.2",
    "native-base": "^2.7.1",
    "prop-types": "^15.6.2",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
    "react-native-animatable": "^1.3.0",
    "react-native-expo-image-cache": "^3.1.1",
    "react-native-linear-gradient": "^2.4.0",
    "react-native-modal": "^6.1.0",
    "react-native-motion": "^0.2.0",
    "react-native-progress": "^3.5.0",
    "react-native-progress-bar-classic": "^1.2.1",
    "react-native-search-box": "^0.0.18",
    "react-native-sideswipe": "^1.4.2",
    "react-native-snap-carousel": "^3.7.2",
    "react-native-tab-view": "^1.0.2",
    "react-native-ui-lib": "^3.3.188",
    "react-native-vector-icons": "^4.6.0",
    "react-native-video": "^2.3.1",
    "react-navigation": "^2.9.3",
    "react-navigation-fluid-transitions": "^0.2.1",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-actions": "^2.6.1",
    "redux-api-middleware": "^3.0.0-beta.3",
    "redux-define": "^1.1.1",
    "redux-effex": "^1.1.2",
    "redux-persist": "^5.10.0",
    "sentry-expo": "~1.9.0"
  },
  "devDependencies": {
    "babel-eslint": "^8.2.6",
    "eslint": "^4.19.1",
    "eslint-config-airbnb": "^17.0.0",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-import": "^2.13.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.9.1",
    "eslint-plugin-react-native": "^3.2.1",
    "jest-expo": "^29.0.0",
    "react-native-scripts": "^1.14.0",
    "react-test-renderer": "^16.4.1",
    "reactotron-react-native": "^2.0.0",
    "reactotron-redux": "^2.0.0"
  }

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.