amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Android confirmSignIn erroring with "Value at 'session' failed to satisfy constraint: Member must have length less than or equal to 8192"

Open kevinxu3 opened this issue 6 months ago • 21 comments

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify CLI

Environment information

# Put output below this line
 System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 150.92 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    npm: 10.2.3 - /usr/local/bin/npm
    Watchman: 2025.03.03.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 136.1.78.94
    Chrome: 136.0.7103.114
    Safari: 18.3.1
  npmPackages:
    @aws-amplify/react-native: ^1.1.10 => 1.1.10 
    @aws-amplify/rtn-push-notification: ^1.1.1 => 1.2.35 
    @babel/core: ^7.25.2 => 7.27.3 
    @babel/preset-env: ^7.25.3 => 7.27.2 
    @babel/runtime: ^7.25.0 => 7.27.3 
    @expo/react-native-action-sheet: ^4.0.1 => 4.1.1 
    @expo/vector-icons: ^14.0.0 => 14.1.0 
    @google-cloud/recaptcha-enterprise-react-native: 18.7.0-beta01 => 18.7.0-beta01 
    @react-native-async-storage/async-storage: 1.23.1 => 1.23.1 
    @react-native-community/cli: 15.0.1 => 15.0.1 
    @react-native-community/cli-platform-android: 15.0.1 => 15.0.1 
    @react-native-community/cli-platform-ios: 15.0.1 => 15.0.1 
    @react-native-community/netinfo: 11.4.1 => 11.4.1 
    @react-native-masked-view/masked-view: 0.3.2 => 0.3.2 
    @react-native/babel-preset: 0.77.1 => 0.77.1 (0.76.7, 0.76.9)
    @react-native/eslint-config: 0.77.1 => 0.77.1 
    @react-native/metro-config: 0.77.1 => 0.77.1 
    @react-native/typescript-config: 0.77.1 => 0.77.1 
    @react-navigation/bottom-tabs: ^7.3.3 => 7.3.13 
    @react-navigation/material-top-tabs: ^7.2.3 => 7.2.13 
    @react-navigation/native: ^7.0.19 => 7.1.9 
    @react-navigation/native-stack: ^7.3.3 => 7.3.13 
    @react-navigation/stack: ^7.2.3 => 7.3.2 
    @reduxjs/toolkit: ^1.9.5 => 1.9.7 
    @reduxjs/toolkit-query:  1.0.0 
    @reduxjs/toolkit-query-react:  1.0.0 
    @rnmapbox/maps: ^10.1.38 => 10.1.39 
    @tsconfig/react-native: ^3.0.0 => 3.0.5 
    @turf/helpers: ^7.2.0 => 7.2.0 (6.5.0)
    @types/jest: ^29.5.13 => 29.5.14 
    @types/lodash: ^4.17.16 => 4.17.17 
    @types/qrcode: ^1.5.5 => 1.5.5 
    @types/react: ^18.2.6 => 18.3.23 
    @types/react-test-renderer: ^18.0.0 => 18.3.1 
    @types/uuid: ^10.0.0 => 10.0.0 (9.0.8)
    ContextAPIMixpanel:  0.0.1 
    MixpanelDemo:  0.0.1 
    SimpleMixpanel:  0.0.1 
    aws-amplify: ^6.15.0 => 6.15.0 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/adapter-core/internals:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/internals:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/data:  undefined ()
    aws-amplify/data/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    axios: ^1.9.0 => 1.9.0 
    babel-jest: ^29.6.3 => 29.7.0 
    eslint: ^8.19.0 => 8.57.1 
    expo: ^52.0.0 => 52.0.46 
    expo-camera: ~16.0.18 => 16.0.18 
    expo-clipboard: ~7.0.1 => 7.0.1 
    expo-constants: ~17.0.8 => 17.0.8 
    expo-haptics: ~14.0.1 => 14.0.1 
    expo-image: ~2.0.6 => 2.0.7 
    expo-image-manipulator: ~13.0.6 => 13.0.6 
    expo-location: ~18.0.8 => 18.0.10 
    expo-media-library: ~17.0.6 => 17.0.6 
    expo-notifications: ^0.29.14 => 0.29.14 
    expo-splash-screen: ~0.29.22 => 0.29.24 
    formik: ^2.4.2 => 2.4.6 
    geojson: ^0.5.0 => 0.5.0 
    jest: ^29.6.3 => 29.7.0 
    libphonenumber-js: ^1.11.4 => 1.12.8 
    libphonenumber-js/build:  undefined ()
    libphonenumber-js/core:  undefined ()
    libphonenumber-js/max:  undefined ()
    libphonenumber-js/max/metadata:  undefined ()
    libphonenumber-js/min:  undefined ()
    libphonenumber-js/min/metadata:  undefined ()
    libphonenumber-js/mobile:  undefined ()
    libphonenumber-js/mobile/examples:  undefined ()
    libphonenumber-js/mobile/metadata:  undefined ()
    lottie-react-native: 7.1.0 => 7.1.0 
    metro-react-native-babel-preset: ^0.76.9 => 0.76.9 
    mixpanel-react-native: ^2.3.1 => 2.4.1 
    moment: ^2.29.4 => 2.30.1 
    prettier: 2.8.8 => 2.8.8 
    react: 18.3.1 => 18.3.1 (17.0.2)
    react-native: 0.76.7 => 0.76.7 
    react-native-compressor: ^1.11.0 => 1.11.0 
    react-native-draggable-flatlist: ^4.0.1 => 4.0.3 
    react-native-gesture-handler: ~2.20.2 => 2.20.2 
    react-native-get-random-values: ~1.11.0 => 1.11.0 
    react-native-image-crop-picker: ^0.40.0 => 0.40.3 
    react-native-linear-gradient: ^2.7.3 => 2.8.3 
    react-native-maps: 1.18.0 => 1.18.0 
    react-native-pager-view: ^6.7.0 => 6.8.1 
    react-native-phone-number-input: ^2.1.0 => 2.1.0 
    react-native-qrcode-styled: ^0.3.3 => 0.3.3 
    react-native-reanimated: ~3.16.1 => 3.16.7 
    react-native-safe-area-context: 4.12.0 => 4.12.0 
    react-native-screens: ~4.4.0 => 4.4.0 
    react-native-skeleton-placeholder: ^5.2.4 => 5.2.4 
    react-native-svg: 15.8.0 => 15.8.0 
    react-native-tab-view: ^3.5.2 => 3.5.2 (4.1.0)
    react-native-url-polyfill: ^1.3.0 => 1.3.0 (2.0.0)
    react-redux: ^8.0.7 => 8.1.3 
    react-test-renderer: 18.3.1 => 18.3.1 
    typescript: 5.0.4 => 5.0.4 
    uuid: ^10.0.0 => 10.0.0 (9.0.1, 8.3.2, 7.0.3)
    yup: ^1.2.0 => 1.6.1 
  npmGlobalPackages:
    corepack: 0.22.0
    ios-deploy: 1.12.2
    npm: 10.2.3
    typescript: 5.5.3


Describe the bug

Calling confirmSignIn on Android returns regardless of the size of the challengeResponse put in: Value at 'session' failed to satisfy constraint: Member must have length less than or equal to 8192

This is not an issue on iOS, only Android. Previously when I was still using Auth.sendCustomChallengeAnswer', I could log the User object I passed in and the session` field for the User object was indeed larger than 8192 in length. This was not the case with iOS.

Expected behavior

Should call confirmSignIn successfully.

Reproduction steps

On an Android device.

  1. Call signIn
  2. Call confirmSignIn

Code Snippet

Log output

// Put your logs below this line
[InvalidParameterException: 1 validation error detected: Value at 'session' failed to satisfy constraint: Member must have length less than or equal to 8192]

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

No response

kevinxu3 avatar May 29 '25 16:05 kevinxu3

Hi @kevinxu3, thanks for reporting. We'll try reproducing this and get back to you once we have more information.

Thanks!

pranavosu avatar May 29 '25 19:05 pranavosu

Hi @kevinxu3 I haven't been able to reproduce this issue. And I get the expected successful sign in. Can you share some code snippets of how you are making the calls? Also can you confirm which confirmSignIn method you are using (EMAIL, SMS, TOTP)?

Also my testing was done with the following versions

"dependencies": {
    "@aws-amplify/react-native": "^1.1.10",

    "aws-amplify": "^6.15.0",

    "expo": "~53.0.9",
 
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "react-native": "^0.79.2",
   
  }

nadetastic avatar Jun 02 '25 17:06 nadetastic

I am using a physical device if that makes a difference. Sometimes it does work which is strange but for the most part it does not. When I log signInOutput I see CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE. This also seems to be a new occurrence since I first noticed it consistently when Google Play was denying my app because they weren't able to sign in.

    // Attempt sign in
    const signInOutput = await signIn({
      username: phoneNumber,
      options: {
        authFlowType: "CUSTOM_WITHOUT_SRP",
      },
    });

    console.log(signInOutput);
    // Send verification code
    await confirmSignIn({ challengeResponse: token });

kevinxu3 avatar Jun 02 '25 21:06 kevinxu3

I'm using the below versions that are different. The other packages are the same. I do not have react-dom

"expo": "^52.0.0",
"react": "18.3.1",
"react-native": "0.76.7",

kevinxu3 avatar Jun 02 '25 21:06 kevinxu3

It looks like this session token is constructed by Amplify not Cognito is that correct? It looks like it might be based off of the userAgent which could explain why this is happening on my android device and not ios. I can't seem to find where we create the session token so I can't confirm if it does use the userAgent.

https://github.com/aws-amplify/amplify-js/blob/936c0f79f061a14b239695f3aa2222d4fb9ac028/packages/auth/src/providers/cognito/utils/signInHelpers.ts#L478

kevinxu3 avatar Jun 02 '25 21:06 kevinxu3

Hi any updates on this? This is big blocker for us since Android devices can't sign in consistently.

kevinxu3 avatar Jun 05 '25 00:06 kevinxu3

I checked the userAgent and it's a short string like aws-amplify/6.15.0 auth/4 framework/202. I also logged the response from await initiateAuth and the Session token in response is 8420 in length. It seems to be consistently that length.

kevinxu3 avatar Jun 06 '25 02:06 kevinxu3

@kevinxu3 thank you for the updates, I'm still investigating this and will provide some updates soon. Do you mind sharing the full payload of the logged response? You can obfuscate any sensitive values and replace them with place holder values

nadetastic avatar Jun 06 '25 13:06 nadetastic

Sure. I included the Session token since I assume this is safe to share.

{"$metadata": {"attempts": 1, "cfId": undefined, "extendedRequestId": undefined, "httpStatusCode": 200, "requestId": "b4eefcca-1054-4c1b-8466-9c2d06fd4552"}, "ChallengeName": "CUSTOM_CHALLENGE", "ChallengeParameters": {"USERNAME": "<--REDACTED-->"}, "Session": "AYABeLOv5GmGzQX9O0HtLR3TU4wAHQABAAdTZXJ2aWNlABBDb2duaXRvVXNlclBvb2xzAAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMTo3NDU2MjM0Njc1NTU6a2V5L2IxNTVhZmNhLWJmMjktNGVlZC1hZmQ4LWE5ZTA5MzY1M2RiZQC4AQIBAHhR9E4zNbI1ofi3Y01_Ljgh2wK-ZaC__bKufjbgmejy4gHQnFuiNYXr4u06x1f_MIBmAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMBwRxu84Sptza2Um7AgEQgDvD8r9yO6hy0o5OCpd1XvysRhvIGl8wqO1kaWCPneBZ11HV1D4TaN7APd1CA7UBq-6nShKj7Vjni47A2QIAAAAADAAAEAAAAAAAAAAAAAAAAADEC7VX-7KPO7zIfDW0-ekiAAAAAQAAAAAAAAAAAAAAASJpTBywyujY6sxs_8lEexfAb-K63w-mE8QpfJLZhqHu3nc2w949n_lDBmz28k7zfz5_gDscxwmPI9k_3F4BM_wYVM3jP2jUdG83_qxAKIXd75ZEqVC_A0oDjXRBYQ6KugjaSAIfPloXh0G8_5lRGSQ4k6lbTack9WKkoFKmX5V3n7DrF-mDVt3D2gBkPNZAKOj6f_jzpXWMRyt53lv8DbO30xeD2UWcj6yNWNG7xnrdQzzI4C7oYfwLA6Jn8dTL86xhlHbz6M_v7VGwngsyRvd7WJ2UZ33HZfHuidUPfI9tosfHHv-G6CNqR--ZM1_NoMxZMjfCaVM7-AY7VyrFTuL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3

Thanks for sharing the additional info @kevinxu3 , from the looks of it, it looks like at least one of the custom auth challenges that you have is resulting in a session token that is larger than what is expected. To clarify, the Session is generated by Cognito, and is included in the response from Cognito if it is determined that the application needs to pass another challenge.

Can you explain a bit more about your custom auth flow, and some of the challenges that are included?

From my testing, my session length is between 900-1100k, and my challenges include

  • PASSWORD_VERIFIER (session length is 946)
  • CUSTOM_CHALLENGE 1 (session length is 998)
  • CUSTOM_CHALLENGE 2 (session length is 1035)

Also it may be beneficial to inspect the network instead and evaluate the response payload, and also log the session object within the DefineAuth lambda

This is how i am calling signIn

await signIn({
  username,
  password,
  options: {
    authFlowType: "CUSTOM_WITH_SRP",
  },
});

nadetastic avatar Jun 06 '25 19:06 nadetastic

I'm using CUSTOM_WITHOUT_SRP. My auth flow does not require a password. It first expects a reCaptcha v3 token to verify the client is not a bot and then sends an SMS and the user needs to respond with the correct code.

How are you inspecting the network for react native? I've been trying to find a good way to do this. In my DefineAuth, the session field is an empty array. I compared the invocation events for DefineAuth and CreateAuth for a failed request and a working iOS request, and they are identical.

kevinxu3 avatar Jun 06 '25 21:06 kevinxu3

I was able to get it working when running on an Android emulator for Google Pixel. I'm using a physical device a Samsung Flip3 which isn't working. I'm wondering how the device impacts the session token since it seems to be different lengths depending on the device.

Also, the Google Play store has rejected updates due to this issue, so it's also happening on their end on their devices.

kevinxu3 avatar Jun 06 '25 21:06 kevinxu3

@kevinxu3 What is the challenge name after sign in when you see the issue?

const user = await Auth.signIn(username, password);
console.log(user.challengeName);

pranavosu avatar Jun 06 '25 23:06 pranavosu

My signIn code looks like this:

    const signInOutput = await signIn({
      username: phoneNumber,
      options: {
        authFlowType: "CUSTOM_WITHOUT_SRP",
      },
    });

    console.log(signInOutput);

This is the log output:

{
    "isSignedIn": false,
    "nextStep": {
        "additionalInfo": {
            "USERNAME": "<--REDACTED-->"
        },
    "signInStep": "CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE"
    }
}

kevinxu3 avatar Jun 07 '25 02:06 kevinxu3

Hello @kevinxu3 , we are working on reproducing this issue. We will get back to you when we have an update.

Could you confirm that the reCaptcha v3 token and the SMS code are the only challenges presented? Also could you provide if there's any device remembering setting?

Simone319 avatar Jun 13 '25 14:06 Simone319

Yes those are the only changes. I don't believe I have any device remember settings. What would that look like?

kevinxu3 avatar Jun 14 '25 00:06 kevinxu3

Any updates on this? I'm still experiencing this issue and it's impact our android testing and releases.

kevinxu3 avatar Jun 18 '25 02:06 kevinxu3

Hi @kevinxu3 for reference, device rememberance steps are documented here but it more likely that you do not have this setup.

To continue investigating this, could you add a logging statement in your Define Auth lambda function that prints the contents of the session? You can access it as event.request.session as documented in the Cognito docs here and may need to JSON.stringify it.

This can help in confirming what the shape/size of the session looks like in Cognito and compare it to what we see on the client.

nadetastic avatar Jun 18 '25 02:06 nadetastic

Device remembrance is not on. The Define Auth lambda does not have a event.request.session logged since it's the initial request with no session token yet. Create Auth lambda also does not have event.request.session. I believe the session token is created by the user pool after create auth lambda responds with challenge parameters + acceptable answer in the linked diagram. I'm not sure how to see the token before the client receives it, but I'm pretty sure the issue lies in how cognito user pools is creating the token in the challenges answered step in the diagram since respondToAuthChallenge step fails right after.

https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-challenge.html

kevinxu3 avatar Jun 18 '25 23:06 kevinxu3

This is definitely device specific since this is working on iPhone and an emulated Pixel device and not working on my physical Samsung Flip3, I'm guessing either:

  • Cognito is generating an unexpectedly long session token for certain mobile devices
  • My device is somehow receiving the token from cognito and interpreting it strangely to create an oversized token

The concern though is Google Play sometimes rejects updates because of this I'm guessing also because of the variation of devices they use to verify apps.

kevinxu3 avatar Jun 19 '25 00:06 kevinxu3

Hey @kevinxu3, thanks for providing additional information. We will try to reproduce the error on a Samsung device and will get back to you, once we have an update.

adrianjoshua-strutt avatar Jun 26 '25 14:06 adrianjoshua-strutt