amplify-js: Authentication: Maximum call stack size exceeded
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
# Put output below this line
System:
OS: macOS 11.2
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 16.71 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.9.0 - ~/.nvm/versions/node/v14.9.0/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.9.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 91.0.4472.114
Firefox: 82.0.3
Safari: 14.0.3
npmPackages:
@apollo/client: ^3.3.19 => 3.3.20
@apollo/client/cache: undefined ()
@apollo/client/core: undefined ()
@apollo/client/errors: undefined ()
@apollo/client/link/batch: undefined ()
@apollo/client/link/batch-http: undefined ()
@apollo/client/link/context: undefined ()
@apollo/client/link/core: undefined ()
@apollo/client/link/error: undefined ()
@apollo/client/link/http: undefined ()
@apollo/client/link/persisted-queries: undefined ()
@apollo/client/link/retry: undefined ()
@apollo/client/link/schema: undefined ()
@apollo/client/link/utils: undefined ()
@apollo/client/link/ws: undefined ()
@apollo/client/react: undefined ()
@apollo/client/react/components: undefined ()
@apollo/client/react/context: undefined ()
@apollo/client/react/data: undefined ()
@apollo/client/react/hoc: undefined ()
@apollo/client/react/hooks: undefined ()
@apollo/client/react/parser: undefined ()
@apollo/client/react/ssr: undefined ()
@apollo/client/testing: undefined ()
@apollo/client/utilities: undefined ()
@babel/core: ^7.8.4 => 7.14.6
@babel/runtime: ^7.8.4 => 7.14.6
@react-native-async-storage/async-storage: ^1.15.5 => 1.15.5
@react-native-community/eslint-config: ^1.1.0 => 1.1.0
@react-native-community/masked-view: ^0.1.10 => 0.1.11
@react-native-community/netinfo: ^6.0.0 => 6.0.0
@react-native-firebase/app: ^10.5.0 => 10.8.1
@react-native-firebase/messaging: ^10.5.1 => 10.8.1
@react-navigation/drawer: ^5.11.2 => 5.12.5
@react-navigation/material-top-tabs: ^5.2.16 => 5.3.15
@react-navigation/native: ^5.7.3 => 5.9.4
@react-navigation/stack: ^5.9.0 => 5.14.5
@storybook/addon-actions: ^5.3 => 5.3.21
@storybook/addon-knobs: ^5.3 => 5.3.21
@storybook/addon-links: ^5.3 => 5.3.21
@storybook/addon-ondevice-actions: ^5.3.23 => 5.3.23
@storybook/addon-ondevice-knobs: ^5.3.25 => 5.3.25
@storybook/react-native: ^5.3.25 => 5.3.25
@storybook/react-native-server: ^5.3.23 => 5.3.23
@testing-library/jest-native: ^3.4.3 => 3.4.3
@testing-library/react-native: ^7.0.2 => 7.2.0
@types/enzyme: ^3.10.7 => 3.10.8
@types/jest: ^25.2.3 => 25.2.3
@types/lodash: ^4.14.161 => 4.14.170
@types/react-dom: ^17.0.3 => 17.0.8
@types/react-native: ^0.63.2 => 0.63.52 (0.64.10)
@types/react-native-vector-icons: ^6.4.5 => 6.4.7
@types/react-test-renderer: ^16.9.2 => 16.9.5
@typescript-eslint/eslint-plugin: ^2.27.0 => 2.34.0
@typescript-eslint/parser: ^2.27.0 => 2.34.0
HelloWorld: 0.0.1
amazon-cognito-identity-js: ^5.0.5 => 5.0.5
apollo-link-rest: ^0.8.0-beta.0 => 0.8.0-beta.0
aws-amplify: ^4.2.0 => 4.2.0
aws-amplify-react-native: ^5.0.3 => 5.0.3
axios: ^0.21.1 => 0.21.1
babel-jest: ^25.1.0 => 25.5.1 (26.6.3)
babel-loader: ^8.2.2 => 8.2.2
babel-plugin-module-resolver: ^4.0.0 => 4.1.0
detox: ^17.9.0 => 17.14.9
enzyme: ^3.11.0 => 3.11.0
enzyme-adapter-react-16: ^1.15.5 => 1.15.6
eslint: ^6.5.1 => 6.8.0
eslint-config-prettier: ^6.11.0 => 6.15.0
events: ^3.2.0 => 3.3.0
graphql: ^15.5.0 => 15.5.1 (14.0.0)
graphql-anywhere: ^4.2.7 => 4.2.7
hermes-inspector-msggen: 1.0.0
immutability-helper: ^3.1.1 => 3.1.1
jest: ^25.1.0 => 25.5.4
jest-circus: ^26.5.3 => 26.6.3
jest-enzyme: ^7.1.2 => 7.1.2
jest-transform-stub: ^2.0.0 => 2.0.0
jsdom: ^16.4.0 => 16.6.0 (11.12.0, 15.2.1)
lodash: ^4.17.20 => 4.17.21 (3.10.1)
metro-react-native-babel-preset: ^0.59.0 => 0.59.0
prettier: ^2.0.4 => 2.3.1
qs: ^6.10.1 => 6.10.1 (6.7.0, 6.9.6, 6.5.2)
react: 16.13.1 => 16.13.1 (16.14.0)
react-animated: 0.1.0
react-dom: ^16.13.1 => 16.14.0
react-native: 0.63.2 => 0.63.2
react-native-bootsplash: ^3.1.2 => 3.2.4
react-native-code-push: ^6.3.0 => 6.4.1
react-native-config: ^1.3.3 => 1.4.2
react-native-credit-card-input: ^0.4.1 => 0.4.1
react-native-device-info: ^8.1.3 => 8.1.3
react-native-geolocation-service: ^5.0.0 => 5.2.0
react-native-gesture-handler: ^1.8.0 => 1.10.3
react-native-gifted-chat: ^0.16.3 => 0.16.3
react-native-google-places-autocomplete: ^1.8.3 => 1.9.0
react-native-image-crop-picker: ^0.35.0 => 0.35.3
react-native-keyboard-aware-scroll-view: ^0.9.2 => 0.9.4
react-native-linear-gradient: ^2.5.6 => 2.5.6
react-native-localization: ^2.1.6 => 2.1.7
react-native-maps: 0.27.1 => 0.27.1
react-native-permissions: ^2.2.1 => 2.2.2
react-native-reanimated: ^1.13.0 => 1.13.3
react-native-safe-area-context: ^3.1.7 => 3.2.0
react-native-screens: ^2.10.1 => 2.18.1
react-native-tab-view: ^2.15.1 => 2.16.0
react-native-vector-icons: ^7.1.0 => 7.1.0
react-test-renderer: 16.13.1 => 16.13.1 (16.14.0)
twilio-chat: ^4.1.0 => 4.1.0
typescript: ^3.8.3 => 3.9.10
waait: ^1.0.5 => 1.0.5
wait-for-expect: ^3.0.2 => 3.0.2
npmGlobalPackages:
appcenter-cli: 2.7.4
eas-cli: 0.14.1
expo-cli: 4.7.2
expo: 40.0.1
npm: 6.14.8
Describe the bug
When using functions from Auth, I always get the error on my debugger console.
import { Auth } from 'aws-amplify'
function useAuth() {
//...other code
useEffect(() => {
async function loadData() {
try {
await Auth.currentSession()
setAuthenticated(true)
setLoaded(true)
} catch (error) {
setLoaded(true)
}
}
loadData()
}, [])
//...other code
}
Error on console:

The functions still work but they throw the “Maximum call stack size” error everytime I call them.
Expected behavior
No error on console
Reproduction steps
- Install the packages following the react-native guide in readme.
- Import the Auth class from ‘aws-amplify’
- Call a function, ex:
Auth.signInorAuth.currentSession - Watch the errors on console.
Code Snippet
import { Auth } from 'aws-amplify'
function useAuth() {
//...other code
useEffect(() => {
async function loadData() {
try {
await Auth.currentSession()
setAuthenticated(true)
setLoaded(true)
} catch (error) {
setLoaded(true)
}
}
loadData()
}, [])
//...other code
}
Log output
ExceptionsManager.js:179 Unhandled promise rejection RangeError: Maximum call stack size exceeded
at new Promise (es.promise.js:240)
at Promise.then (es.promise.js:297)
at core.js:84
at new Promise (es.promise.js:238)
at safeThen (core.js:82)
at Promise.then (core.js:74)
at es.promise.js:298
at new Promise (es.promise.js:238)
at Promise.then (es.promise.js:297)
at core.js:84
reactConsoleErrorHandler @ ExceptionsManager.js:179
overrideMethod @ backend.js:12506
registerError @ LogBox.js:148
errorImpl @ LogBox.js:59
console.error @ LogBox.js:33
module.exports @ host-report-errors.js:6
dispatchEvent @ es.promise.js:150
(anonymous) @ es.promise.js:163
module.exports @ perform.js:3
(anonymous) @ es.promise.js:160
(anonymous) @ JSTimers.js:274
_callTimer @ JSTimers.js:130
_callImmediatesPass @ JSTimers.js:181
callImmediates @ JSTimers.js:441
__callImmediates @ MessageQueue.js:387
(anonymous) @ MessageQueue.js:135
__guard @ MessageQueue.js:364
flushedQueue @ MessageQueue.js:134
invokeCallbackAndReturnFlushedQueue @ MessageQueue.js:130
(anonymous) @ RNDebuggerWorker.js:2
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
My package.json:
{
"name": "MyAapp",
"version": "0.0.1",
"private": true,
"scripts": {
},
"dependencies": {
"@apollo/client": "^3.3.19",
"@react-native-async-storage/async-storage": "^1.15.5",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^6.0.0",
"@react-native-firebase/app": "^10.5.0",
"@react-native-firebase/messaging": "^10.5.1",
"@react-navigation/drawer": "^5.11.2",
"@react-navigation/material-top-tabs": "^5.2.16",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"amazon-cognito-identity-js": "^5.0.5",
"apollo-link-rest": "^0.8.0-beta.0",
"aws-amplify": "^4.2.0",
"aws-amplify-react-native": "^5.0.3",
"axios": "^0.21.1",
"events": "^3.2.0",
"graphql": "^15.5.0",
"graphql-anywhere": "^4.2.7",
"immutability-helper": "^3.1.1",
"lodash": "^4.17.20",
"qs": "^6.10.1",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-bootsplash": "^3.1.2",
"react-native-code-push": "^6.3.0",
"react-native-config": "^1.3.3",
"react-native-credit-card-input": "^0.4.1",
"react-native-device-info": "^8.1.3",
"react-native-geolocation-service": "^5.0.0",
"react-native-gesture-handler": "^1.8.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-google-places-autocomplete": "^1.8.3",
"react-native-image-crop-picker": "^0.35.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-linear-gradient": "^2.5.6",
"react-native-localization": "^2.1.6",
"react-native-maps": "0.27.1",
"react-native-permissions": "^2.2.1",
"react-native-reanimated": "^1.13.0",
"react-native-safe-area-context": "^3.1.7",
"react-native-screens": "^2.10.1",
"react-native-tab-view": "^2.15.1",
"react-native-vector-icons": "^7.1.0",
"twilio-chat": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"@storybook/addon-actions": "^5.3",
"@storybook/addon-knobs": "^5.3",
"@storybook/addon-links": "^5.3",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.25",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23",
"@testing-library/jest-native": "^3.4.3",
"@testing-library/react-native": "^7.0.2",
"@types/enzyme": "^3.10.7",
"@types/jest": "^25.2.3",
"@types/lodash": "^4.14.161",
"@types/react-dom": "^17.0.3",
"@types/react-native": "^0.63.2",
"@types/react-native-vector-icons": "^6.4.5",
"@types/react-test-renderer": "^16.9.2",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"babel-jest": "^25.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-module-resolver": "^4.0.0",
"detox": "^17.9.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.11.0",
"jest": "^25.1.0",
"jest-circus": "^26.5.3",
"jest-enzyme": "^7.1.2",
"jest-transform-stub": "^2.0.0",
"jsdom": "^16.4.0",
"metro-react-native-babel-preset": "^0.59.0",
"prettier": "^2.0.4",
"react-dom": "^16.13.1",
"react-test-renderer": "16.13.1",
"typescript": "^3.8.3",
"waait": "^1.0.5",
"wait-for-expect": "^3.0.2"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"setupFilesAfterEnv": [
"./node_modules/react-native-gesture-handler/jestSetup.js",
"./setupTest.js"
],
"moduleNameMapper": {
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
"\\.(css|less)$": "identity-obj-proxy"
}
}
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 16 (7 by maintainers)
Does any
Authmethod call result in this error? Or justAuth.currentSessionspecifically? I’m trying to narrow this down as much as possible so that the team knows where to look.