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.42k stars 2.12k forks source link

Auth signInWithRedirect stuck at inflight status #13834

Open lwang-79 opened 1 day ago

lwang-79 commented 1 day ago

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify CLI

Environment information

``` System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Memory: 1.41 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.5.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.2.4 - /opt/homebrew/bin/npm Browsers: Chrome: 129.0.6668.58 Safari: 17.5 npmPackages: @ampproject/toolbox-optimizer: undefined () @aws-sdk/client-transcribe-streaming: ^3.645.0 => 3.645.0 @babel/core: undefined () @babel/runtime: 7.15.4 @chakra-ui/icons: ^2.1.0 => 2.1.0 @chakra-ui/next-js: ^2.1.5 => 2.1.5 @chakra-ui/react: ^2.8.0 => 2.8.0 @edge-runtime/cookies: 3.2.1 @edge-runtime/ponyfill: 2.3.0 @edge-runtime/primitives: 3.0.1 @emotion/react: ^11.11.1 => 11.11.1 @emotion/styled: ^11.11.0 => 11.11.0 @hapi/accept: undefined () @napi-rs/triples: undefined () @next/bundle-analyzer: ^13.4.19 => 13.4.19 @next/font: undefined () @next/react-dev-overlay: undefined () @opentelemetry/api: undefined () @segment/ajv-human-errors: undefined () @types/node: 20.4.8 => 20.4.8 @types/prismjs: ^1.26.4 => 1.26.4 @types/react: 18.2.18 => 18.2.18 @types/react-dom: 18.2.7 => 18.2.7 @types/readable-stream: ^4.0.15 => 4.0.15 @vercel/nft: undefined () @vercel/og: undefined () acorn: undefined () amphtml-validator: undefined () amplify: ^0.0.11 => 0.0.11 anser: undefined () arg: undefined () assert: undefined () async-retry: undefined () async-sema: undefined () 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 () babel-packages: undefined () browserify-zlib: undefined () browserslist: undefined () buffer: undefined () bytes: undefined () chalk: undefined () ci-info: undefined () cli-select: undefined () client-only: 0.0.1 comment-json: undefined () compression: undefined () conf: undefined () constants-browserify: undefined () content-disposition: undefined () content-type: undefined () cookie: undefined () cross-env: ^7.0.3 => 7.0.3 cross-spawn: undefined () crypto-browserify: undefined () css.escape: undefined () data-uri-to-buffer: undefined () debug: undefined () devalue: undefined () domain-browser: undefined () edge-runtime: undefined () encoding: ^0.1.13 => 0.1.13 eslint: 8.46.0 => 8.46.0 eslint-config-next: 13.4.12 => 13.4.12 events: undefined () find-cache-dir: undefined () find-up: undefined () framer-motion: ^10.15.0 => 10.15.0 fresh: undefined () get-orientation: undefined () glob: undefined () gzip-size: undefined () http-proxy: undefined () http-proxy-agent: undefined () https-browserify: undefined () https-proxy-agent: undefined () icss-utils: undefined () ignore-loader: undefined () image-size: undefined () is-animated: undefined () is-docker: undefined () is-wsl: undefined () jest-docblock: undefined () jest-worker: undefined () json5: undefined () jsonwebtoken: undefined () loader-runner: undefined () loader-utils: undefined () lodash.curry: undefined () lru-cache: undefined () micromatch: undefined () microphone-stream: ^6.0.1 => 6.0.1 mini-css-extract-plugin: undefined () nanoid: undefined () native-url: undefined () neo-async: undefined () next: 13.4.12 => 13.4.12 node-fetch: undefined () node-html-parser: undefined () ora: undefined () os-browserify: undefined () p-limit: undefined () path-browserify: undefined () platform: undefined () 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 () prismjs: ^1.29.0 => 1.29.0 process: undefined () punycode: undefined () querystring-es3: undefined () raw-body: undefined () react: 18.2.0 => 18.2.0 react-builtin: undefined () react-dom: 18.2.0 => 18.2.0 react-dom-builtin: undefined () react-dom-experimental-builtin: undefined () react-experimental-builtin: undefined () react-is: 18.2.0 react-refresh: 0.12.0 react-server-dom-webpack-builtin: undefined () react-server-dom-webpack-experimental-builtin: undefined () react-textarea-autosize: ^8.5.3 => 8.5.3 react-webcam: ^7.1.1 => 7.1.1 regenerator-runtime: 0.13.4 sass-loader: undefined () scheduler-builtin: undefined () scheduler-experimental-builtin: undefined () schema-utils: undefined () semver: undefined () send: undefined () server-only: 0.0.1 setimmediate: undefined () shell-quote: undefined () slate: ^0.101.5 => 0.101.5 slate-history: ^0.100.0 => 0.100.0 slate-react: ^0.101.5 => 0.101.5 source-map: undefined () stacktrace-parser: undefined () status: ^0.0.13 => 0.0.13 stream-browserify: undefined () stream-http: undefined () string-hash: undefined () string_decoder: undefined () strip-ansi: undefined () tar: undefined () terser: undefined () text-table: undefined () timers-browserify: undefined () tty-browserify: undefined () typescript: 5.1.6 => 5.1.6 ua-parser-js: undefined () undici: undefined () unistore: undefined () util: undefined () vm-browserify: undefined () watchpack: undefined () web-vitals: undefined () webpack: undefined () webpack-sources: undefined () ws: undefined () zod: undefined () npmGlobalPackages: @aws-amplify/cli: 11.0.3 @types/node: 18.7.4 @ziglang/cli: 0.0.12 aws-cdk: 2.131.0 npm: 10.2.4 nx: 16.6.0 ts-node: 10.9.1 typescript: 4.8.4 yarn: 1.22.19 ```

Describe the bug

I recently updated the aws-amplify library version in an existing project and encountered the issue.

When the app redirects from sign in with Google, it gets stuck in an inflight status. The app does not continue to get the token from Cognito as usual, and the inflightAuth value in local storage is true.

When I revert to the previous version, everything works fine. After some tests, I found that the last working version for me was v6.0.21. The issue appears to be related to the PR #13162

Could you please check it? Should I change anything from my app? Thank you!

Expected behavior

The app can get token after redirect.

Reproduction steps

  1. install aws-amplify version after 6.0.21.
  2. use signInWithRedirect to start Google sign in I can not replicate the issue on my another project. It's probably specific to my project, but I don't know how to debug. Any suggestion would be highly appreciated.

Code Snippet

signInWithRedirect({ provider: 'Google' })

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

joon-won commented 1 day ago

Hey @lwang-79, thank you for reaching out to the team, and sharing us the details! I can see your app is currently using 6.0.23 based on the environment information you've provided us, have you considered using the latest v6 version which is 6.6.2 and see if the issue persists?

lwang-79 commented 21 hours ago

Hi @joon-won, thank you for looking into this. I encountered the issue after updating to the latest version. I tested different versions and found that the problem started with v6.0.23.

joon-won commented 10 hours ago

@lwang-79, got it. We'll take a look into the issue. Appreciate your patience