New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V6 upgrade causes AuthUserPoolException #12627
Comments
Downgrade I had the same problem when I upgraded @aws-amplify/auth from v6.0.2 to v6.0.5. It worked again when I downgraded to v6.0.2, but I had to downgrade @aws-amplify/core as well. |
Unfortunately v6.0.2 is not working to me neither :( |
Have you downgraded both dependencies? |
Yeah, and I made sure that's the version installed in both auth/core, no luck, same error... |
Hi @pablovargasosorio thanks for opening this issue. Quick question, are you calling |
HI @nadetastic - I can confirm I've just run in to this issue as well. |
@dkhuntrods thank you for the context, can you share the code of how you have implemented your TokenProvider? |
@nadetastic The reloc path is a 'virtual' route with no components, but I tried to just importing the sign-in method in the same place I do the Amplify.configure, but I it doesn't fix it. |
@pablovargasosorio can you confirm that you installed For example import { Amplify } from 'aws-amplify'
import { signInWithRedirect } from 'aws-amplify/auth' // not '@aws-amplify/auth'
import { Hub } from 'aws-amplify/utils' |
For me this error happen during signOut. So I just downgrade to "aws-amplify": "^6.0.2" as mention by @rkstgr. In the code I import like this as mention by @nadetastic
Now it working. Thank @rkstgr @nadetastic. |
@nadetastic That was the reason of the issue. I changed my package.json FROM:
TO:
Also changed my imports to use from 'aws-amplify/auth', instead of '@aws-amplify/auth' and login works I strongly recommend to improve the changelog documentation to let us know the '@' notation is deprecated in V6... |
Glad to have gotten your issues resolved! @pablovargasosorio thank you for the feedback! We are working to make improvements in the migration guide 🙂 |
@nadetastic I'm having a similar problem. I'm on version 6.0.2 defined in my package.json as "aws-amplify": "6.0.2". The configure method runs, but when I attempt to sign in, I get this error: error signing in AuthUserPoolException: Auth UserPool not configured. I have checked the userPoolId, userClientPoolId and identityPoolId, which all exist in Cognito. The error seems be happening when calling Amplify.getConfig() in the signInWithSRP function. authConfig is undefined. Here's my stack trace and code below. Is there something I'm missing?
|
Hi @InspiredJason can you provide a bit more context on you app? What framework is it (Angular for ex)? And an example of how you are using the |
Hi @nadetastic - thanks for the reply. We're using SST as our serverless framework including a React frontend. Below is an extract of the signin component along. Essentially, just a react component, which configures Amplify, then a call to our sign in function shown in my message above in our AuthStore class. I've also included the result of a call to Amplify.getConfig() after calling configure(). Anything stick out to you?
|
Can confirm removing individual @aws-amplify packages for each module and using just ONE package: |
@mnovati Thanks for your reply. I can confirm I have it working. I didn't have any @amplify references in my package.json file. But I did go ahead and delete my node_modules folder and install amplify 6.0.5. Perhaps @amplify references were still kicking about in my node_modules? @nadetastic thanks for investigating - happy to have this sorted. |
I hope I'm on time to the party... it's not working! Upd: never mind... was trying to call fetchAuthSession() on public page I can't figure out what's causing it, custom and default configs have the same effect. This happens on main public page, there is no authentication.
Deps
|
Hi @OperationalFallacy, just to confirm, is this an issue for you? |
@nadetastic to clarify, things are a bit unclear. A few points:
Thanks for checking and helping improve things. |
@willjstevens thanks for the feedback and context! Let me clarify a bit: The first and second links in item 1, is the proper way to set up the resources, however it doesn't clearly show I'm working to clarify the documentation in Configure Amplify categories (item 1 links) to clearly show how to configure identityPoolId and a few more options 😃 |
The config here is not valid according to the typescript types in 6.0.2 |
Just adding this for reference if others see this because seems like a lot of activity on the thread, This is not related to the config questions, but if you have the problem If you were using |
I'm still facing with this issue
|
And Amplify.getConfig() only return empty object |
@natuan62 For me I had to use Amplify.configure() in both a server component and a client component. I'm using Next.js so I put it into my Amplify context file in the initialization process. |
I can confirm this 👍 After removing our used category So, since v6 you need to install the whole "aws-amplify" package. But you can still import from "aws-amplify/auth" |
I have done that but am still having the same issue |
For those still struggling here, it took me a while but I was able to get everything working. I put together a simple demo stripped from my production app. The demo is not functional but it shows the exact amplify configuration, locked package versions for amplify and nextjs as well as both server and client Amplify.configure implementations. If it is not clear or if it would be beneficial for me to complete the demo to make it run, please lmk. |
In my case, the version inconsistency prevented the signOut from working. "dependencies": {
"@aws-amplify/auth": "^6.0.13",
"@aws-amplify/core": "^6.0.13",
- "aws-amplify": "^6.0.10"
+ "aws-amplify": "^6.0.13"
} Upgrading "aws-amplify" fixed the problem. |
I still have this issue and cannot figure out how to fix it... using |
Same situation of @made2591, also with version 6.0.28, using js (not ts), old (amplify v3) Amplify.configure({
aws_project_region: process.env.REACT_APP_AWS_PROJECT_REGION,
aws_cognito_identity_pool_id: process.env.REACT_APP_AWS_COGNITO_IDENT_POOL,
aws_cognito_region: process.env.REACT_APP_AWS_PROJECT_REGION,
aws_user_pools_id: process.env.REACT_APP_AWS_USER_POOL_ID,
aws_user_pools_web_client_id: process.env.REACT_APP_AWS_WEB_CLIENT,
oauth: {
domain: process.env.REACT_APP_AWS_COGNITO_DOMAINANME,
scope: [
'phone',
'email',
'openid',
'profile',
'aws.cognito.signin.user.admin'
],
redirectSignIn: process.env.REACT_APP_AWS_REDIRECT_SIGN_IN_BEYOND,
redirectSignOut: process.env.REACT_APP_AWS_REDIRECT_SIGN_IN_BEYOND,
responseType: 'code'
},
federationTarget: 'COGNITO_USER_POOLS'
}) new (amplify v6) Amplify.configure({
Auth: {
identityPoolId: process.env.REACT_APP_AWS_COGNITO_IDENT_POOL,
region: process.env.REACT_APP_AWS_PROJECT_REGION,
userPoolWebClientId: process.env.REACT_APP_AWS_WEB_CLIENT,
mandatorySignIn: true,
Cognito: {
userPoolId: process.env.REACT_APP_AWS_USER_POOL_ID,
userPoolClientId: process.env.REACT_APP_AWS_WEB_CLIENT,
identityPoolId: process.env.REACT_APP_AWS_COGNITO_IDENT_POOL,
signUpVerificationMethod: 'code',
loginWith: {
oauth: {
domain: process.env.REACT_APP_AWS_COGNITO_DOMAINANME,
scopes: ['phone', 'email', 'openid', 'profile', 'aws.cognito.signin.user.admin'],
redirectSignIn: [process.env.REACT_APP_AWS_REDIRECT_SIGN_IN_BEYOND],
redirectSignOut: [process.env.REACT_APP_AWS_REDIRECT_SIGN_OUT_BEYOND],
responseType: 'code'
}
},
},
},
}) |
@jgabriel98 I found the cause of my issue. You should be sure 100% you configure amplify - eventually I did it a couple of times - before calling the API (even only to test it, try to call it just before the get or post or whatever call). Just a suggestion, with the other version of amplify same code it wasn't necessary! |
@made2591 i`ll try, thanks. |
@made2591 Amplify.configure({
Auth: {
identityPoolId: process.env.REACT_APP_AWS_COGNITO_IDENT_POOL,
region: process.env.REACT_APP_AWS_PROJECT_REGION,
userPoolWebClientId: process.env.REACT_APP_AWS_WEB_CLIENT,
mandatorySignIn: true,
Cognito: {
userPoolId: process.env.REACT_APP_AWS_USER_POOL_ID,
userPoolClientId: process.env.REACT_APP_AWS_WEB_CLIENT,
identityPoolId: process.env.REACT_APP_AWS_COGNITO_IDENT_POOL,
signUpVerificationMethod: 'code',
loginWith: {
oauth: {
domain: process.env.REACT_APP_AWS_COGNITO_DOMAINANME,
scopes: ['phone', 'email', 'openid', 'profile', 'aws.cognito.signin.user.admin'],
redirectSignIn: [process.env.REACT_APP_AWS_REDIRECT_SIGN_IN_BEYOND],
redirectSignOut: [process.env.REACT_APP_AWS_REDIRECT_SIGN_OUT_BEYOND],
responseType: 'code',
}
},
},
},
})
await signInWithRedirect({ provider, customState }) |
I upgraded from v5 and I'm getting the same error from the promise rejection, but interestingly in error.message it gives [UserAlreadyAuthenticatedException: There is already a signed in user.] |
For future reference, here it is the configuration template: |
Hi everyone I got the same error As previous comments said :
{
Auth: {
Cognito: {
userPoolClientId: "xxxxx",
userPoolId: "xxxxx",
identityPoolId: "xxxxx",
signUpVerificationMethod: "code",
loginWith: {
// Optional
oauth: {
domain: "xxxxx",
scopes: ["email", "openid", "profile", "aws.cognito.signin.user.admin"],
redirectSignIn: ["http://localhost:3000/"],
redirectSignOut: ["http://localhost:3000/"],
responseType: "code"
},
username: "true",
email: "false", // Optional
phone: "false" // Optional
}
}
}
};```
and it worked
thanks to everyone 💯 |
For reference, I found another undocumented option Amplify.configure({
Auth: {
Cognito: {
...
allowGuestAccess: true|false
...
}
}
}); |
Also running into this issue. Tokens come back fine but for whatever reason the |
Did a bit more digging and it's pretty amazing. Developing with react-native and expo. Tracing the logs the issue stems from intermixing esm and cjs. As it stands when I call |
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
After upgrading to aws-amplify/auth v6 I'm unable to login, due to the UserPool configuration:
I'm able to start the login flow (user selection, credentials form, etc.) but when relocation happens to /reloc?code=...... in my homepage, then it fails.
That means the user pool is properly setup from my login page (if not, I couldn't authenticate at all. My login page is running Amplify.configure successfully)
It seems like part of the Amplify framework is not initialized. The exception is provoked by someone who is calling to this assertion function with an empty cognitoConfig (In my config JSON passed to Amplify.configure I do have values for userPoolId and userPoolClientId):
Expected behavior
Successful login
Reproduction steps
Code Snippet
This is my configure call passing the JSON with the user pool:
These are my functions to login (google/microsoft):
Log output
aws-exports.js
No response
Manual configuration
Also tried passing the new model (even though the legacy one above should be converted by the library and works properly)
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
Perhaps the 'configure' call is not fully configuring the Amplify framework. Notice how the DEBUG output is much more complete in v5 in the login page. This is before I try to login, so before I get the UserPool exception or any other error in the browser console.
The text was updated successfully, but these errors were encountered: