aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

UnexpectedSignInInterruptionException during sign-in affecting a subset of users after upgrade to Amplify v6 #13182

Closed MarekBodingerBA closed 3 months ago

MarekBodingerBA commented 8 months ago

Before opening, please confirm:

JavaScript Framework

React, Next.js

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Other

Environment information

``` System: OS: Windows 11 10.0.22631 CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12500 Memory: 7.88 GB / 31.77 GB Binaries: Node: 20.9.0 - ~\AppData\Local\Volta\tools\image\node\20.9.0\node.EXE Yarn: 1.22.19 - ~\AppData\Local\Volta\tools\image\yarn\1.22.19\bin\yarn.CMD npm: 10.1.0 - ~\AppData\Local\Volta\tools\image\node\20.9.0\npm.CMD Browsers: Edge: Chromium (122.0.2365.92) Internet Explorer: 11.0.22621.1 npmPackages: @ampproject/toolbox-optimizer: undefined () @aws-amplify/adapter-nextjs: 1.0.23 => 1.0.23 @aws-amplify/adapter-nextjs/api: undefined () @aws-amplify/adapter-nextjs/data: undefined () @babel/core: undefined () @babel/runtime: 7.22.5 @edge-runtime/cookies: 4.1.0 @edge-runtime/ponyfill: 2.4.2 @edge-runtime/primitives: 4.1.0 @grafana/faro-core: ^1.0.5 => 1.4.2 @grafana/faro-web-sdk: ^1.0.2 => 1.4.2 @hapi/accept: undefined () @hookform/resolvers: ^2.9.10 => 2.9.11 @hookform/resolvers/ajv: 1.0.0 @hookform/resolvers/class-validator: 1.0.0 @hookform/resolvers/computed-types: 1.0.0 @hookform/resolvers/io-ts: 1.0.0 @hookform/resolvers/joi: 1.0.0 @hookform/resolvers/nope: 1.0.0 @hookform/resolvers/superstruct: 1.0.0 @hookform/resolvers/typanion: 1.0.0 @hookform/resolvers/vest: 1.0.0 @hookform/resolvers/yup: 1.0.0 @hookform/resolvers/zod: 1.0.0 @internationalized/date: 3.5.2 => 3.5.2 @jest/globals: ^29.5.0 => 29.7.0 @mswjs/interceptors: undefined () @napi-rs/triples: undefined () @next/font: undefined () @next/react-dev-overlay: undefined () @openapitools/openapi-generator-cli: ^2.9.0 => 2.12.0 @opentelemetry/api: undefined () @radix-ui/react-dropdown-menu: ^2.0.6 => 2.0.6 @radix-ui/react-navigation-menu: ^1.1.4 => 1.1.4 @react-aria/utils: 3.23.2 => 3.23.2 @react-stately/utils: 3.9.1 => 3.9.1 @rjsf/core: 5.18.1 => 5.18.1 @rjsf/utils: 5.18.1 => 5.18.1 @rjsf/validator-ajv8: 5.18.1 => 5.18.1 @svgr/webpack: 6.5.1 => 6.5.1 @tanstack/eslint-plugin-query: 5.27.7 => 5.27.7 @tanstack/query-codemods: 4.24.3 @tanstack/react-query: 5.28.0 => 5.28.0 @testing-library/jest-dom: ^5.16.5 => 5.17.0 @testing-library/react: ^13.4.0 => 13.4.0 @types/adm-zip: ^0.5.5 => 0.5.5 @types/lodash: 4.17.0 => 4.17.0 @types/mime-types: ^2.1.1 => 2.1.4 @types/node: 18.11.18 => 18.11.18 (20.11.28) @types/object-hash: ^3.0.5 => 3.0.6 @types/qs: ^6.9.12 => 6.9.12 @types/react: 18.2.65 => 18.2.65 (18.2.66) @types/react-beforeunload: ^2.1.1 => 2.1.5 @types/react-dom: 18.2.22 => 18.2.22 @types/traverse: ^0.6.32 => 0.6.36 @types/uuid: ^9.0.1 => 9.0.8 @types/xml2js: ^0.4.14 => 0.4.14 @typescript-eslint/eslint-plugin: 7.2.0 => 7.2.0 @typescript-eslint/parser: 7.2.0 => 7.2.0 (6.21.0) @vercel/nft: undefined () @vercel/og: 0.6.2 acorn: undefined () add-to-calendar-button-react: ^2.2.3 => 2.6.6 adm-zip: ^0.5.10 => 0.5.12 ajv: 8.12.0 => 8.12.0 (6.12.6) ajv-formats: 2.1.1 => 2.1.1 amphtml-validator: undefined () anser: undefined () arg: undefined () assert: undefined () async-retry: undefined () async-sema: undefined () autoprefixer: 10.4.18 => 10.4.18 aws-amplify: 6.0.23 => 6.0.23 aws-amplify/adapter-core: 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/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.4.0 => 1.6.7 (1.6.5) babel-packages: undefined () browserify-zlib: undefined () browserslist: undefined () buffer: undefined () bytes: undefined () ci-info: undefined () classnames: 2.5.1 => 2.5.1 cli-select: undefined () client-only: 0.0.1 comment-json: undefined () compression: undefined () conditional-wrap: ^1.0.2 => 1.0.2 conf: undefined () constants-browserify: undefined () content-disposition: undefined () content-type: undefined () cookie: undefined () cross-spawn: undefined () crypto-browserify: undefined () css.escape: undefined () data-uri-to-buffer: undefined () debug: undefined () devalue: undefined () domain-browser: undefined () edge-runtime: undefined () eslint: 8.57.0 => 8.57.0 eslint-config-adjunct: 4.13.0 => 4.13.0 eslint-config-airbnb: 19.0.4 => 19.0.4 eslint-config-airbnb-typescript: 18.0.0 => 18.0.0 eslint-config-auto: 0.9.0 => 0.9.0 eslint-config-next: 14.1.3 => 14.1.3 eslint-config-prettier: 9.1.0 => 9.1.0 eslint-plugin-array-func: 5.0.1 => 5.0.1 eslint-plugin-const-case: 1.2.2 => 1.2.2 eslint-plugin-eslint-comments: 3.2.0 => 3.2.0 eslint-plugin-html: 8.0.0 => 8.0.0 eslint-plugin-import: 2.29.1 => 2.29.1 eslint-plugin-jest: 27.9.0 => 27.9.0 eslint-plugin-jest-async: 1.0.3 => 1.0.3 eslint-plugin-jest-dom: 5.1.0 => 5.1.0 eslint-plugin-json: 3.1.0 => 3.1.0 eslint-plugin-lodash: 7.4.0 => 7.4.0 eslint-plugin-lodash-fp: 2.2.0-a1 => 2.2.0a1 eslint-plugin-markdown: 4.0.1 => 4.0.1 eslint-plugin-no-constructor-bind: 2.0.4 => 2.0.4 eslint-plugin-no-secrets: 0.8.9 => 0.8.9 eslint-plugin-no-unsanitized: 4.0.2 => 4.0.2 eslint-plugin-no-use-extend-native: 0.5.0 => 0.5.0 eslint-plugin-optimize-regex: 1.2.1 => 1.2.1 eslint-plugin-pii: 1.0.2 => 1.0.2 eslint-plugin-prettier: 5.1.3 => 5.1.3 eslint-plugin-promise: 6.1.1 => 6.1.1 eslint-plugin-react-hooks: 4.6.0 => 4.6.0 eslint-plugin-scanjs-rules: 0.2.1 => 0.2.1 eslint-plugin-security: 2.1.1 => 2.1.1 eslint-plugin-simple-import-sort: 12.0.0 => 12.0.0 eslint-plugin-sonarjs: 0.24.0 => 0.24.0 eslint-plugin-switch-case: 1.1.2 => 1.1.2 eslint-plugin-tailwindcss: 3.15.1 => 3.15.1 eslint-plugin-testing-library: 6.2.0 => 6.2.0 eslint-plugin-unicorn: 51.0.1 => 51.0.1 eslint-plugin-xss: 0.1.12 => 0.1.12 events: undefined () expr-eval: ^2.0.2 => 2.0.2 find-cache-dir: undefined () find-up: undefined () focus-trap-react: ^10.2.3 => 10.2.3 fresh: undefined () get-orientation: undefined () glob: undefined () gzip-size: undefined () http-proxy: undefined () http-proxy-agent: undefined () https-browserify: undefined () https-proxy-agent: undefined () husky: ^8.0.1 => 8.0.3 i18next: 23.10.1 => 23.10.1 icss-utils: undefined () ignore-loader: undefined () image-size: undefined () is-animated: undefined () is-docker: undefined () is-wsl: undefined () jest: ^29.5.0 => 29.7.0 jest-each: ^29.7.0 => 29.7.0 jest-environment-jsdom: ^29.5.0 => 29.7.0 jest-worker: undefined () js-cookie: ^3.0.1 => 3.0.5 (2.2.1) json-schema: ^0.4.0 => 0.4.0 json5: undefined () jsonwebtoken: undefined () lint-staged: ^15.2.2 => 15.2.2 loader-runner: undefined () loader-utils: undefined () lodash: 4.17.21 => 4.17.21 lodash.curry: undefined () lru-cache: undefined () micromatch: undefined () mime-types: ^2.1.35 => 2.1.35 mini-css-extract-plugin: undefined () nanoid: undefined () native-url: undefined () neo-async: undefined () next: 14.1.3 => 14.1.3 next-i18next: 15.2.0 => 15.2.0 next-i18next-create-client: undefined () next-plausible: ^3.12.0 => 3.12.0 node-fetch: undefined () node-html-parser: undefined () nuqs: ^1.17.0 => 1.17.1 object-hash: ^3.0.0 => 3.0.0 ora: undefined () os-browserify: undefined () p-limit: undefined () path-browserify: undefined () pino: ^8.16.2 => 8.19.0 pino-pretty: ^10.2.3 => 10.3.1 platform: undefined () postcss: 8.4.35 => 8.4.35 (8.4.31) postcss-flexbugs-fixes: undefined () postcss-modules-extract-imports: undefined () postcss-modules-local-by-default: undefined () postcss-modules-scope: undefined () postcss-modules-values: undefined () postcss-preset-env: undefined () postcss-safe-parser: undefined () postcss-scss: undefined () postcss-value-parser: undefined () pre-commit: ^1.2.2 => 1.2.2 prettier: 3.2.5 => 3.2.5 prettier-plugin-tailwindcss: 0.5.12 => 0.5.12 pretty-bytes: ^6.1.1 => 6.1.1 process: undefined () punycode: undefined () qs: ^6.11.2 => 6.12.0 querystring-es3: undefined () raw-body: undefined () react: 18.2.0 => 18.2.0 react-aria: 3.32.1 => 3.32.1 react-aria-components: 1.1.1 => 1.1.1 react-beforeunload: ^2.6.0 => 2.6.0 react-builtin: undefined () react-cookie-consent: 7.5.0 => 7.5.0 react-dom: 18.2.0 => 18.2.0 react-dom-builtin: undefined () react-dom-experimental-builtin: undefined () react-experimental-builtin: undefined () react-hook-form: ^7.42.1 => 7.51.0 react-i18next: 14.1.0 => 14.1.0 react-is: 18.2.0 react-loading-skeleton: ^3.3.1 => 3.4.0 react-markdown: ^9.0.0 => 9.0.1 react-refresh: 0.12.0 react-remove-scroll: ^2.5.5 => 2.5.7 (2.5.5) react-resize-detector: ^8.0.3 => 8.1.0 react-select: ^5.8.0 => 5.8.0 react-server-dom-turbopack-builtin: undefined () react-server-dom-turbopack-experimental-builtin: undefined () react-server-dom-webpack-builtin: undefined () react-server-dom-webpack-experimental-builtin: undefined () react-simple-snackbar: ^1.1.11 => 1.1.11 react-stately: 3.30.1 => 3.30.1 react-turnstile: ^1.1.0 => 1.1.3 react-usestateref: ^1.0.8 => 1.0.8 regenerator-runtime: 0.13.4 rehype-raw: ^7.0.0 => 7.0.0 rehype-sanitize: ^6.0.0 => 6.0.0 remark-directive: ^3.0.0 => 3.0.0 remark-directive-rehype: ^0.4.2 => 0.4.2 remark-gfm: ^4.0.0 => 4.0.0 remark-supersub: ^1.0.0 => 1.0.0 rooks: 5.11.8 => 5.11.8 sass-loader: undefined () scheduler-builtin: undefined () scheduler-experimental-builtin: undefined () schema-utils: undefined () semver: undefined () send: undefined () server-only: 0.0.1 setimmediate: undefined () sharp: 0.33.2 => 0.33.2 shell-quote: undefined () slugify: ^1.6.6 => 1.6.6 source-map: undefined () stacktrace-parser: undefined () stream-browserify: undefined () stream-http: undefined () string-hash: undefined () string_decoder: undefined () strip-ansi: undefined () superstruct: undefined () tailwind-merge: 2.2.1 => 2.2.1 tailwind-scrollbar-hide: 1.1.7 => 1.1.7 tailwindcss: 3.4.1 => 3.4.1 tar: undefined () terser: undefined () text-table: undefined () timers-browserify: undefined () transport: 0.0.1 traverse: ^0.6.7 => 0.6.8 tty-browserify: undefined () typescript: 5.4.2 => 5.4.2 ua-parser-js: undefined () unistore: undefined () universal-cookie: ^4.0.4 => 4.0.4 usehooks-ts: 2.16.0 => 2.16.0 util: undefined () uuid: ^9.0.0 => 9.0.1 (8.3.2) vm-browserify: undefined () watchpack: undefined () web-vitals: undefined () webpack: undefined () webpack-sources: undefined () ws: undefined () xml2js: ^0.6.2 => 0.6.2 yet-another-react-lightbox: ^3.15.4 => 3.17.1 zod: undefined () npmGlobalPackages: corepack: 0.20.0 npm: 10.1.0 ```

Describe the bug

After update to Amplify V6, part of our userbase started reporting being not able to sign in. In the logs we've found that our users are getting UnexpectedSignInInterruptionException (150 instances in two weeks since the update, with thousands of active users). https://github.com/aws-amplify/amplify-js/blob/0ddaa3cc1257f5f006e5c3d534e19e866521c4bd/packages/auth/src/providers/cognito/utils/dispatchSignedInHubEvent.ts#L30

It was not possible to Google any instance of anyone getting the same error, also there are no issues mentioning this either. The provided remedy in the recoverySuggestion is to "ensure cookies can be correctly set from your server". I suspect that if our server wouldn't be able to set cookies correctly, it would happen in 100% cases, therefore I think it is a bug.

After trying on 10s of users, we were not able to reproduce the issue ourselves, however our project is completely open source which makes it easy to share the code:

Amplify config: https://github.com/bratislava/konto.bratislava.sk/blob/ba71f78deed6202541dec776efeddc239be3766e/next/frontend/utils/amplifyConfig.ts Login sequence: https://github.com/bratislava/konto.bratislava.sk/blob/ba71f78deed6202541dec776efeddc239be3766e/next/pages/prihlasenie.tsx#L36 Environmental variables: https://github.com/bratislava/konto.bratislava.sk/blob/ba71f78deed6202541dec776efeddc239be3766e/next/.env.bratiska-cli-build.prod package.json: https://github.com/bratislava/konto.bratislava.sk/blob/ba71f78deed6202541dec776efeddc239be3766e/next/package.json Amplify config before the update: https://github.com/bratislava/konto.bratislava.sk/blob/f9e2ec6c0f57b0fb8ff871b0d3490d58f6ac6acf/next/frontend/utils/amplify.ts Login sequence before the update: https://github.com/bratislava/konto.bratislava.sk/blob/f9e2ec6c0f57b0fb8ff871b0d3490d58f6ac6acf/next/pages/prihlasenie.tsx#L43

Thank you.

Expected behavior

The authentication process should successfully complete without any errors, allowing users access to their accounts without any interruptions or discrepancies in the sign-in flow.

Reproduction steps

As the issue has not been reproducible on our end despite attempts with tens of users, we're unable to provide specific steps that consistently trigger the UnexpectedSignInInterruptionException. Below are the general steps a user would follow, which for some results in the error:

  1. Navigate to the sign-in page of our application.
  2. Enter valid user credentials (username and password).
  3. Click the "Prihlásiť sa" button to initiate the authentication process.

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

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

israx commented 8 months ago

This exception happens usually when there is a domain miss match after the user is being authenticated. For instance, if your cookies are configured with the http://www.a.com/ domain, and your users are authenticated on the http://app.a.com/ domain.

Will your end-users always be authenticated into one domain ? Or is this domain changing based on some scenarios ?

MarekBodingerBA commented 8 months ago

@israx Thank you for the response. I checked the logs, all the users are attempting to sign-in on:

https://konto.bratislava.sk/prihlasenie

This doesn't differ in any way from successful logins. We don't use any other domains and there are no dynamic scenarios.

HuiSF commented 8 months ago

Hi @MarekBodingerBA Do you have any data from the logs that what browsers were these users using?

MarekBodingerBA commented 8 months ago

@HuiSF Nothing suspicious from my side, I extracted the related fields from the logs:

``` [ { "timestamp": "2024-03-27 17:50:24.152 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-27 12:37:37.676 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-26 09:43:34.794 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-26 09:41:26.091 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-26 09:41:21.287 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-26 08:31:59.649 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 19:36:17.622 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 19:35:07.353 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 19:35:04.191 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 19:34:40.425 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 14:51:36.461 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:50:26.744 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:50:06.146 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:49:50.875 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:48:26.003 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:48:20.752 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:34:51.655 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:34:50.68 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:34:47.989 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:34:45.351 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 14:34:41.781 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-25 13:31:26.931 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-25 13:28:46.703 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-25 13:19:48.978 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 13:17:23.145 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 13:16:54.69 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 13:16:20.432 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 13:15:59.012 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-25 09:42:41.39 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 22:34:30.509 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 22:34:22.573 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:38:03.833 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:38:00.755 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:37:56.976 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:36:35.451 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:36:32.488 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:36:28.588 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:36:02.692 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:35:44.373 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:35:38.33 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:35:26.65 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:35:17.842 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 16:35:02.6 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-24 12:11:55.821 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-23 20:13:47.201 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-23 20:13:21.111 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-23 19:12:10.936 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-23 19:12:06.819 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-23 19:11:52.611 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-23 19:11:49.057 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-22 17:11:58.827 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-22 16:09:09.61 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-22 16:09:02.101 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "123.0.0.0" }, { "timestamp": "2024-03-22 12:55:23.696 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-22 10:18:19.474 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-22 10:17:28.98 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-22 09:02:50.262 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 18:00:21.509 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 17:59:31.592 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 17:59:23.61 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 17:57:45.158 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 17:57:40.545 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 17:57:28.313 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 12:14:14.401 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-21 09:52:58.22 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 09:51:47.974 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 09:51:04.454 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 09:50:54.693 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-21 07:57:23.62 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 14:30:27.379 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 13:31:14.26 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 13:30:38.59 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 11:28:18.577 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 11:11:56.407 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 11:10:36.807 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 08:45:53.712 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 08:45:32.312 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 07:55:14.879 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:54:57.641 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:54:54.896 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:54:42.645 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:54:39.394 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:53:52.536 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:53:39.47 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:53:08.673 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:52:56.261 +0000 UTC", "browser_name": "Opera", "browser_os": "Windows 10", "browser_version": "107.0.0.0" }, { "timestamp": "2024-03-20 07:18:03.105 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 06:16:19.871 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 06:13:29.932 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-20 06:13:19.518 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 17:28:54.368 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-19 17:24:17.409 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 17:20:25.379 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 17:20:17.066 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 17:19:55.868 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 12:53:18.545 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-19 12:52:57.297 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 21:14:51.569 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-18 21:14:23.605 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-18 18:22:20.874 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-18 18:21:12.614 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 18:21:02.63 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 12:20:17.936 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 12:19:26.339 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 12:19:07.326 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 12:17:34.875 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 09:43:00.501 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 09:42:49.344 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 09:42:46.013 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 09:42:42.682 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 07:28:28.075 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 07:27:08.705 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:19:57.907 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:19:31.198 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:18:56.147 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:18:48.561 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:18:46.662 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-18 05:18:42.764 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:43.348 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:42.123 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:40.675 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:38.869 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:37.547 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:34.922 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:32.082 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:30.617 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:27.243 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:26:24.726 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-17 16:25:42.688 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-15 19:55:54.851 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "121.0.0.0" }, { "timestamp": "2024-03-15 08:33:08.934 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-15 08:32:34.515 +0000 UTC", "browser_name": "Edge", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 19:37:29.099 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 19:37:08.498 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 19:37:00.602 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 19:36:50.515 +0000 UTC", "browser_name": "Chrome", "browser_os": "Android 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 15:32:06.809 +0000 UTC", "browser_name": "Facebook", "browser_os": "Android 12", "browser_version": "454.1.0.49.104" }, { "timestamp": "2024-03-14 15:31:51.103 +0000 UTC", "browser_name": "Facebook", "browser_os": "Android 12", "browser_version": "454.1.0.49.104" }, { "timestamp": "2024-03-14 15:26:24.024 +0000 UTC", "browser_name": "Facebook", "browser_os": "Android 12", "browser_version": "454.1.0.49.104" }, { "timestamp": "2024-03-14 14:39:18.479 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 14:39:12.391 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 14:38:57.817 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 14:38:50.514 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 14:31:50.446 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 14:31:40.052 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:27:05.123 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:26:53.622 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:26:49.336 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:26:43.105 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:26:39.144 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" }, { "timestamp": "2024-03-14 12:26:35.635 +0000 UTC", "browser_name": "Chrome", "browser_os": "Windows 10", "browser_version": "122.0.0.0" } ] ```
HuiSF commented 8 months ago

Thanks @MarekBodingerBA and yes I don't see anything that is abnormal.

When you are saying you were not able to reproduce this issue, did you try to login using the credentials of a real user who was not able to login?

There could be something that causes the library token parsing logic to fail while retrieving authentication tokens from the cookie store (per {ssr: true}) right after a successful sign-in. Could you provide the following information?

  1. the username value of a user who was not able to sign in due to this issue, it should be the value of the user name column seen in the Cognito console
  2. Do you have any pre token lambda trigger that manipulates auth tokens before sending back to the client during a sign in process?
  3. Are there any special characters get embedded into the auth tokens?
mpinter commented 8 months ago

@HuiSF hi. I'm also one of the maintainers of this project, filling in some of the data requested:

  1. the following user has these issues for sure - 2bf74b91-22f2-46c4-b342-74ede104a7e4 . We can probably get more if needed.
  2. we have a post authentication trigger which adds/updates a custom:sign_in_at property, adding code below:
import AWS from "aws-sdk";

export const handler = async (event) => {
  console.log(event);
  const userSub = event.request?.userAttributes?.sub;
  if (!userSub) {
    throw new Error("No userSub found in event.request.UserAttributes");
  }

  const cognitoIdentity = new AWS.CognitoIdentityServiceProvider({
    accessKeyId: process.env.AWS_COGNITO_ACCESS,
    secretAccessKey: process.env.AWS_COGNITO_SECRET,
    region: process.env.AWS_COGNITO_REGION,
  });

  await cognitoIdentity
    .adminUpdateUserAttributes({
      UserAttributes: [
        {
          Name: "custom:sing_in_at",
          Value: new Date().toISOString(),
        },
      ],
      UserPoolId: process.env.AWS_COGNITO_USERPOOL_ID,
      Username: userSub,
    })
    .promise();

  return event;
};

edit: today we're not relying too much on this extra attribute, it helped us with user migration some time ago - so if there's a chance this will help the issue, we can just turn this trigger off - in fact, I'll do it right away to collect some data on this

  1. did not see any. So far we haven't tried logging in as this user (will probably need to contact them through support about changing their password to a temporary one), but I've copied over all of their user attributes except for sub and email into another account and could not reproduce the problem this way
cwomack commented 8 months ago

Thank you @mpinter for the extra context here. We'll try to reproduce this on our side then, but if you find a way to more reliably reproduce then let us know!

CC: @MarekBodingerBA

cwomack commented 8 months ago

@mpinter and @MarekBodingerBA, are either one of you able to join us on a call to demo/reproduce the behavior (if possible) and allow us to review your Cognito setup? So far, we have been unable to reproduce the issue so far (using the publicly available code that's been provided. We'd also like to know the following, but can cover this in a call if you would prefer:

** Please do not share any email addresses of the customers publicly on this GitHub issue

mpinter commented 7 months ago

@cwomack would be happy to jump on a call (and thank's a lot for being involved in this). We can likely arrange with both of us with @MarekBodingerBA , probably Tuesday the earliest as Monday is still easter holiday, or later in the week if preferred.

So far:

mpinter commented 7 months ago

Updated info - we've tried changing the pw and logging into the 2bf74b91-22f2-46c4-b342-74ede104a7e4 user account and could not reproduce the issue. Waiting on confirmation from the user whether the issue keeps happening on their side.

We've added the user agent info to our production logs, if we catch a new instance of the issue we'll be able to provide those.

cwomack commented 7 months ago

@mpinter, thanks for the update. Let us know if you're able to catch the new instance of this.

As for a call to review/connect, could you reach out to me on our Discord server and send me a DM with your email? Want to keep it off the public issue here. Have the same alias/handle there as here on Github, @cwomack.

MarekBodingerBA commented 7 months ago

@cwomack We were able to contact some of the users that it's happening to and with high certainty we can tell that it is device specific issue (however the user agents don't differ from successfully sign-ins), the same people were able to sign-in on a different device.

Also, it seems that these are not new users, so we think some residual cookies / local storage values can interfere with login, so we are now testing this approach: https://github.com/bratislava/konto.bratislava.sk/pull/924/files

We will inform you if it worked.

erinleigh90 commented 7 months ago

@MarekBodingerBA Have you been able to validate this approach or are you still seeing this issue?

MarekBodingerBA commented 7 months ago

@erinleigh90 (Un)fortunately we haven't had any occurrences of the error since 5th March (with couple of thousands successful sign-ins). We deployed this on 8th March, so we cannot evaluate.

MarekBodingerBA commented 6 months ago

We haven't had the exception since then, I am closing the issue.

yp717 commented 6 months ago

We are experiencing the same issue. I believe it may be related to the mismatch in the cookie store between Amplify v5 and v6. Our working hypothesis is that for users that were signed in during the upgrade to v6, there may be a mismatch in amplify's expectations that does not refresh the state correctly. After clearing the cookies manually, we are able to sign in with a user account that was affected by the switch.

armenr commented 6 months ago

We're getting bitten by this exact behavior currently...we're totally stuck. Unclear what a fix may be.

MarekBodingerBA commented 6 months ago

I am reopening the issue, we've had an occurrence on May 10th, we also have a log where user cookies has been removed, but the user didn't try to sign in again unfortunately, so we cannot really say if it helped or not.

cwomack commented 6 months ago

@yp717, @armenr, @MarekBodingerBA, @mpinter

We'll look into this further and try to reproduce. Do any of you have a minimal sample repo where this is easily reproduced in a Next.js app? We've tried to reproduce with the repo/samples originally provided in this issue, but didn't have any luck on our side.

mwernsen commented 6 months ago

I've just ran into the UnexpectedSignInInterruptionException myself as well, with the additional message: "Unable to get user session following successful sign-in". They are only showing up in the webkit browser, so as @MarekBodingerBA wrote, it might be device specific.

I ran into these issue while settings op playwright testing for my NextJs application. The very basic sign-in test succeeds on chromium and firefox browser, but fails for the webkit browser. I'm running the most recent version of amplify: 6.3.2.

ColtonGlasgow13 commented 5 months ago

I'm having an identical issue to @mwernsen, where the sign-in fails on webkit with "Unable to get user session following successful sign-in" but is fine otherwise. This is happening in playwright, but it also happens if I open up a safari browser and try to log in manually. Has anyone found a solution to this?

HuiSF commented 5 months ago

Thanks for the report @mwernsen @ColtonGlasgow13 regarding the Webkit based browsers, we will investigate.

HuiSF commented 5 months ago

Hi @mwernsen @ColtonGlasgow13 When you were seeing the issue with a Webkit based browser, were you testing with a local development server? Also what protocol was the server on? http or https?

ColtonGlasgow13 commented 5 months ago

Thanks for looking into it so soon @HuiSF, I'm on a local dev server using http with next.js. The issue is happening whether I use next dev or next start, but I haven't noticed it happening on production builds deployed to Amplify.

HuiSF commented 5 months ago

Thanks for the quick response @ColtonGlasgow13 !

When passing { ssr: true } to Amplify.configure(), Amplify initiates a cookie store interface and stores the auth tokens in the browser cookie store. By default, following the best practices, it sets the cookie secure attribute to true. Webkit-based browsers, such as Safari, restrictively require the server to run with the https protocol; otherwise, they ignore any cookie operations. Due to this, after a user signed in, the auth tokens were not written into the cookie store, hence the failure.

HuiSF commented 5 months ago

Hi @armenr @MarekBodingerBA could you get the info what browser did the end users use to trigger this issue?

ColtonGlasgow13 commented 5 months ago

Thanks @HuiSF, that solved it. Not too hard of a fix with the --experimental-https flag.

cwomack commented 5 months ago

Just wanted to add another possible scenario where this UnexpectedSignInInterruptionException may occur. If the client browser has denied all cookies, then it's possible that the error can be thrown due to Amplify needing access to the cookie store interface.

cwomack commented 5 months ago

@MarekBodingerBA and @armenr, want to ping you both again to see if you had a chance to review @HuiSF's comment. Let us know if you're still experiencing this issue.

cwomack commented 3 months ago

Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.

Thank you!

armenr commented 3 weeks ago

Sorry for being late to this @HuiSF & @cwomack -- It turned out to be a terrible configuration issue, whereby the app was being run in non-SSR mode (locally), but there was a config elsewhere still telling the rest of the app that it is, in fact, running in SSR.

Stated simply: PEBKAC