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

When trying to sign-in using Google auth, it says: OAuth - Error handling auth response. Error: Internal+server+error #10197

Closed THPubs closed 2 years ago

THPubs commented 2 years ago

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

``` # Put output below this line System: OS: macOS 12.5 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 148.48 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.0 - ~/.volta/tools/image/node/16.15.0/bin/node Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn npm: 8.5.5 - ~/.volta/tools/image/node/16.15.0/bin/npm Browsers: Brave Browser: 104.1.42.88 Chrome: 104.0.5112.79 Firefox Developer Edition: 104.0 Safari: 15.6 npmPackages: @ant-design/icons: ^4.7.0 => 4.7.0 @apollo/client: ^3.5.6 => 3.5.6 @aws-amplify/api: ^4.0.48 => 4.0.48 @aws-amplify/auth: ^4.6.1 => 4.6.1 @aws-amplify/cache: ^4.0.50 => 4.0.50 @aws-amplify/core: ^4.6.1 => 4.6.1 @aws-amplify/storage: ^4.5.1 => 4.5.1 @aws-amplify/ui-react: ^3.3.0 => 3.3.0 @babel/core: ^7.16.7 => 7.16.7 @babel/node: ^7.16.7 => 7.16.7 @graphql-codegen/cli: ^2.3.1 => 2.3.1 @graphql-codegen/introspection: ^2.1.1 => 2.1.1 @graphql-codegen/near-operation-file-preset: ^2.2.3 => 2.2.3 @graphql-codegen/schema-ast: ^2.4.1 => 2.4.1 @graphql-codegen/typescript: ^2.4.2 => 2.4.2 @graphql-codegen/typescript-operations: ^2.2.2 => 2.2.2 @hookform/resolvers: ^2.9.7 => 2.9.7 @percy/cypress: ^3.1.1 => 3.1.1 @sentry/nextjs: ^6.18.2 => 6.18.2 @slack/web-api: ^6.5.1 => 6.5.1 @svgr/webpack: ^5.5.0 => 5.5.0 @testing-library/cypress: ^8.0.2 => 8.0.2 @types/jest: ^27.4.1 => 27.4.1 @types/lodash: ^4.14.182 => 4.14.182 @types/mongodb: ^4.0.7 => 4.0.7 @types/node: ^16.11.18 => 16.11.18 @types/react: ^17.0.47 => 17.0.47 @types/sanitize-html: ^2.6.2 => 2.6.2 @types/signale: ^1.4.3 => 1.4.3 @typescript-eslint/eslint-plugin: ^4.33.0 => 4.33.0 @typescript-eslint/parser: ^4.33.0 => 4.33.0 amazon-cognito-identity-js: ^5.2.10 => 5.2.10 antd: 4.18.2 => 4.18.2 antd-img-crop: ^3.16.0 => 3.16.0 apexcharts: ^3.32.1 => 3.32.1 aws-sdk: ^2.1049.0 => 2.1049.0 axios: ^0.25.0 => 0.25.0 babel-eslint: ^10.1.0 => 10.1.0 babel-plugin-dynamic-import-node: ^2.3.3 => 2.3.3 babel-plugin-import: ^1.13.3 => 1.13.3 babel-preset-env: ^1.7.0 => 1.7.0 bluebird: ^3.7.2 => 3.7.2 casual: ^1.6.2 => 1.6.2 consola: ^2.15.3 => 2.15.3 core-js: ^3.20.2 => 3.20.2 cypress: ^9.5.4 => 9.5.4 cypress-dark: ^1.8.3 => 1.8.3 dotenv: ^10.0.0 => 10.0.0 eslint: 7.32.0 => 7.32.0 eslint-config-airbnb: 18.2.0 => 18.2.0 eslint-config-next: ^11.1.3 => 11.1.3 eslint-config-prettier: ^6.15.0 => 6.15.0 eslint-import-resolver-typescript: ^2.5.0 => 2.5.0 eslint-plugin-cypress: ^2.12.1 => 2.12.1 eslint-plugin-import: ^2.25.4 => 2.25.4 eslint-plugin-jsx-a11y: ^6.5.1 => 6.5.1 eslint-plugin-prettier: ^3.4.1 => 3.4.1 eslint-plugin-react: ^7.28.0 => 7.28.0 eslint-plugin-react-hooks: 4.3.0 => 4.3.0 faker: 5.5.3 => 5.5.3 file-saver: ^2.0.5 => 2.0.5 graphql: ^15.8.0 => 15.8.0 graphql-tag: ^2.12.6 => 2.12.6 har-validator: ^5.1.5 => 5.1.5 husky: ^7.0.4 => 7.0.4 i18n-iso-countries: ^6.8.0 => 6.8.0 jotai: ^1.5.0 => 1.5.0 lint-staged: ^11.2.6 => 11.2.6 lodash: ^4.17.21 => 4.17.21 moment: ^2.29.1 => 2.29.1 moment-timezone: ^0.5.34 => 0.5.34 mongodb: ^4.2.2 => 4.2.2 nanoid: ^3.1.30 => 3.1.30 next: ^12.2.2 => 12.2.2 next-plugin-antd-less: ^1.8.0 => 1.8.0 node-fetch: 2.6.2 => 2.6.2 nprogress: ^0.2.0 => 0.2.0 numbro: ^2.3.6 => 2.3.6 ora: ^5.4.1 => 5.4.1 papaparse: ^5.3.1 => 5.3.1 prettier: ^2.5.1 => 2.5.1 rc-select: ^13.2.1 => 13.2.1 rc-upload: ^4.3.3 => 4.3.3 react: ^17.0.2 => 17.0.2 react-blocks: ^1.1.4 => 1.1.4 react-body-classname: ^1.3.1 => 1.3.1 react-dom: ^17.0.2 => 17.0.2 react-google-login: ^5.2.2 => 5.2.2 react-hook-form: ^7.34.0 => 7.34.0 react-password-strength-bar: ^0.3.5 => 0.3.5 react-sticky: ^6.0.3 => 6.0.3 react-toast-notifications: ^2.5.1 => 2.5.1 sanitize-html: ^2.7.0 => 2.7.0 sass: ^1.45.2 => 1.45.2 sharp: ^0.29.3 => 0.29.3 signale: ^1.4.0 => 1.4.0 simplebar: ^5.3.6 => 5.3.6 simplebar-react: ^2.3.6 => 2.3.6 start-server-and-test: ^1.14.0 => 1.14.0 styled-components: ^5.3.3 => 5.3.3 subscriptions-transport-ws: ^0.11.0 => 0.11.0 ts-node: ^10.4.0 => 10.4.0 typescript: ^4.5.4 => 4.5.4 use-deep-compare-effect: ^1.8.1 => 1.8.1 yup: ^0.32.11 => 0.32.11 yup-phone: ^1.3.2 => 1.3.2 zustand: 4.0.0-rc.1 => 4.0.0-rc.1 npmGlobalPackages: corepack: 0.10.0 npm: 8.5.5 ```

Describe the bug

My app have multiple environments (dev, staging, and production). I set up Google Sin-in in the dev environment and everything works fine. But when switched to the staging environment, it breaks. Click on Google sign-in > Click on the google account or sign-in to the google account > Re-direct to the app > The user does not get signed-in. When I check the console, it shows the following error:

next-dev.js?7fd2:24 [ERROR] 08:01.238 OAuth - Error handling auth response. Error: Internal+server+error.+
    at OAuth.eval (OAuth.js?ca4e:244:1)
    at step (OAuth.js?ca4e:55:1)
    at Object.eval [as next] (OAuth.js?ca4e:36:46)
    at eval (OAuth.js?ca4e:30:1)
    at new Promise (<anonymous>)
    at __awaiter (OAuth.js?ca4e:26:1)
    at OAuth.handleAuthResponse (OAuth.js?ca4e:220:1)
    at AuthClass.eval (Auth.js?134d:2271:1)
    at step (Auth.js?134d:55:1)
    at Object.eval [as next] (Auth.js?134d:36:46)
    at eval (Auth.js?134d:30:1)
    at new Promise (<anonymous>)
    at __awaiter (Auth.js?134d:26:1)
    at AuthClass._handleAuthResponse (Auth.js?134d:2233:1)
    at eval (Auth.js?134d:229:1)
    at eval (urlListener.js?d88e:17:1)
    at AuthClass.configure (Auth.js?134d:223:24)
    at eval (Amplify.js?b2f6:84:1)
    at Array.map (<anonymous>)
    at AmplifyClass.configure (Amplify.js?b2f6:83:1)
    at eval (configureAmplify.js?89ed:10:1)
    at ./configureAmplify.js (_app.js?ts=1660300676845:34680:1)
    at options.factory (webpack.js?ts=1660300676845:698:31)
    at __webpack_require__ (webpack.js?ts=1660300676845:37:33)
    at fn (webpack.js?ts=1660300676845:353:21)
    at eval (_app.js:12:75)
    at ./pages/_app.js (_app.js?ts=1660300676845:35758:1)
    at options.factory (webpack.js?ts=1660300676845:698:31)
    at __webpack_require__ (webpack.js?ts=1660300676845:37:33)
    at fn (webpack.js?ts=1660300676845:353:21)
    at eval (?9413:5:16)
    at eval (route-loader.js?7e94:215:51)

I tried to sign in using another Google account, tried different Google client credentials, updated Amplify auth and went through all the settings. Still nothing worked. I then checked the cloud watch logs. Nothing...

Any idea what's happening?

Expected behavior

User to be signed in to the app without issue.

Reproduction steps

  1. Click on Google sign-in
  2. Click on the google account or sign-in to the google account
  3. Re-direct to the app

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line [DEBUG] 25:10.892 AuthClass - Error in cognito hosted auth response Error: Internal+server+error.+ at OAuth.eval (OAuth.js?ca4e:244:1) at step (OAuth.js?ca4e:55:1) at Object.eval [as next] (OAuth.js?ca4e:36:46) at eval (OAuth.js?ca4e:30:1) at new Promise () at __awaiter (OAuth.js?ca4e:26:1) at OAuth.handleAuthResponse (OAuth.js?ca4e:220:1) at AuthClass.eval (Auth.js?134d:2271:1) at step (Auth.js?134d:55:1) at Object.eval [as next] (Auth.js?134d:36:46) at eval (Auth.js?134d:30:1) at new Promise () at __awaiter (Auth.js?134d:26:1) at AuthClass._handleAuthResponse (Auth.js?134d:2233:1) at eval (Auth.js?134d:229:1) at eval (urlListener.js?d88e:17:1) at AuthClass.configure (Auth.js?134d:223:24) at eval (Amplify.js?b2f6:84:1) at Array.map () at AmplifyClass.configure (Amplify.js?b2f6:83:1) at eval (configureAmplify.js?89ed:10:1) at ./configureAmplify.js (_app.js?ts=1660301705941:34680:1) at options.factory (webpack.js?ts=1660301705941:698:31) at __webpack_require__ (webpack.js?ts=1660301705941:37:33) at fn (webpack.js?ts=1660301705941:353:21) at eval (_app.js:12:75) at ./pages/_app.js (_app.js?ts=1660301705941:35758:1) at options.factory (webpack.js?ts=1660301705941:698:31) at __webpack_require__ (webpack.js?ts=1660301705941:37:33) at fn (webpack.js?ts=1660301705941:353:21) at eval (?9413:5:16) at eval (route-loader.js?7e94:215:51) instrument.js?1ea2:109 [DEBUG] 25:10.893 Hub - Dispatching to auth with {event: 'signIn_failure', data: Error: Internal+server+error.+ at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amp…, message: 'The OAuth response flow failed'} data: Error: Internal+server+error.+ at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:255:35) at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:66:23) at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:47:53) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:41:71) at new Promise () at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:37:12) at OAuth.handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:231:16) at AuthClass.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2285:65) at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:69:23) at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:50:53) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:44:71) at new Promise () at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:40:12) at AuthClass._handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2247:16) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:243:23) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/urlListener.js:19:9) at AuthClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:237:69) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:90:18) at Array.map () at AmplifyClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:89:26) at eval (webpack-internal:///./configureAmplify.js:14:59) at ./configureAmplify.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:34680:1) at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31) at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33) at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21) at eval (webpack-internal:///./pages/_app.js:12:75) at ./pages/_app.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:35758:1) at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31) at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33) at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21) at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_app&page=%2F_app!:5:16) at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/client/route-loader.js:247:16) message: "Internal+server+error.+" stack: "Error: Internal+server+error.+\n at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:255:35)\n at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:66:23)\n at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:47:53)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:41:71)\n at new Promise ()\n at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:37:12)\n at OAuth.handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:231:16)\n at AuthClass.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2285:65)\n at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:69:23)\n at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:50:53)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:44:71)\n at new Promise ()\n at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:40:12)\n at AuthClass._handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2247:16)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:243:23)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/urlListener.js:19:9)\n at AuthClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:237:69)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:90:18)\n at Array.map ()\n at AmplifyClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:89:26)\n at eval (webpack-internal:///./configureAmplify.js:14:59)\n at ./configureAmplify.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:34680:1)\n at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31)\n at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33)\n at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21)\n at eval (webpack-internal:///./pages/_app.js:12:75)\n at ./pages/_app.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:35758:1)\n at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31)\n at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33)\n at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21)\n at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_app&page=%2F_app!:5:16)\n at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/client/route-loader.js:247:16)" [[Prototype]]: Object event: "signIn_failure" message: "The OAuth response flow failed" [[Prototype]]: Object [DEBUG] 25:10.894 Hub - Dispatching to auth with {event: 'cognitoHostedUI_failure', data: Error: Internal+server+error.+ at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amp…, message: 'A failure occurred when returning to the Cognito Hosted UI'} data: Error: Internal+server+error.+ at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:255:35) at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:66:23) at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:47:53) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:41:71) at new Promise () at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:37:12) at OAuth.handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:231:16) at AuthClass.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2285:65) at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:69:23) at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:50:53) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:44:71) at new Promise () at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:40:12) at AuthClass._handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2247:16) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:243:23) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/urlListener.js:19:9) at AuthClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:237:69) at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:90:18) at Array.map () at AmplifyClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:89:26) at eval (webpack-internal:///./configureAmplify.js:14:59) at ./configureAmplify.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:34680:1) at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31) at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33) at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21) at eval (webpack-internal:///./pages/_app.js:12:75) at ./pages/_app.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:35758:1) at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31) at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33) at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21) at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_app&page=%2F_app!:5:16) at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/client/route-loader.js:247:16) message: "Internal+server+error.+" stack: "Error: Internal+server+error.+\n at OAuth.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:255:35)\n at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:66:23)\n at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:47:53)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:41:71)\n at new Promise ()\n at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:37:12)\n at OAuth.handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/OAuth/OAuth.js:231:16)\n at AuthClass.eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2285:65)\n at step (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:69:23)\n at Object.eval [as next] (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:50:53)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:44:71)\n at new Promise ()\n at __awaiter (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:40:12)\n at AuthClass._handleAuthResponse (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:2247:16)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:243:23)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/urlListener.js:19:9)\n at AuthClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+auth@4.6.1/node_modules/@aws-amplify/auth/lib-esm/Auth.js:237:69)\n at eval (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:90:18)\n at Array.map ()\n at AmplifyClass.configure (webpack-internal:///./node_modules/.pnpm/@aws-amplify+core@4.6.1/node_modules/@aws-amplify/core/lib-esm/Amplify.js:89:26)\n at eval (webpack-internal:///./configureAmplify.js:14:59)\n at ./configureAmplify.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:34680:1)\n at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31)\n at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33)\n at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21)\n at eval (webpack-internal:///./pages/_app.js:12:75)\n at ./pages/_app.js (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1660301705941:35758:1)\n at options.factory (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:698:31)\n at __webpack_require__ (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:37:33)\n at fn (http://localhost:3000/_next/static/chunks/webpack.js?ts=1660301705941:353:21)\n at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?absolutePagePath=private-next-pages%2F_app&page=%2F_app!:5:16)\n at eval (webpack-internal:///./node_modules/.pnpm/next@12.2.2_cqi3zzjnvb643o7ixnrzsbv4xq/node_modules/next/dist/client/route-loader.js:247:16)" [[Prototype]]: Object event: "cognitoHostedUI_failure" message: "A failure occurred when returning to the Cognito Hosted UI" [DEBUG] 25:11.230 AuthClass - getting current authenticated user instrument.js?1ea2:109 [DEBUG] 25:11.236 AuthClass - get current authenticated userpool user instrument.js?1ea2:109 [DEBUG] 25:11.237 AuthClass - Failed to get user from user pool instrument.js?1ea2:109 [DEBUG] 25:11.237 AuthClass - The user is not authenticated by the error No current user [DEBUG] 25:11.238 Credentials - removing aws-amplify-federatedInfo from storage instrument.js?1ea2:109 [DEBUG] 25:11.238 AuthClass - no current Cognito user instrument.js?1ea2:109 [DEBUG] 25:11.238 Hub - Dispatching to auth with {event: 'signOut', data: null, message: 'A user has been signed out'} data: null event: "signOut" message: "A user has been signed out" [[Prototype]]: Object ```

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

nadetastic commented 2 years ago

Hi @THPubs 👋,

I'm taking a looks at this issue and haven't been able to reproduce it - and each configuring and switching environments is working as expected.

Could you provide steps you took to setup oauth in detail?

One thing to note is each amplify environment will have a unique Hosted UI Endpoint that will contain the environment name that you would then provide to the auth provider.

nadetastic commented 2 years ago

Hi @THPubs, following up on this to see if you still need some help

nadetastic commented 2 years ago

I'll close this issue for now, but feel free to re-open if you still need assistance.