Skip to content

Amplify Gen2 Commands not working, except for SignUp

0

Hello! I have implemented the signin api exactly how it is done in the Gen2 docs, however when my code reaches this api (and similarly for fetchUserAttributes, fetchAuthSession, etc.), my code simply freezes on it (not resolving the promise) nor returning an error message. While the signUp API works as expected. I know my configuration is correct (I am not using the Amplify folder, but rather configuring/generating a client on the NextJS client) given some of these APIs are working, yet it just freezes on these other APIs? Any help is greatly appreciated.

1 Answer
0

It sounds like you're experiencing an issue with some of the Amplify Gen2 authentication APIs in your NextJS application. The fact that the signUp API is working correctly while others are freezing suggests there might be a configuration or initialization problem.

Here are a few things to consider:

  1. Ensure that you have properly configured Amplify in your application. In Amplify Gen2, you need to call Amplify.configure(outputs) before using any Amplify APIs. This should be done in a client-side component or in a useEffect hook if you're using React.

  2. Check that you're importing the correct APIs from the new Amplify Gen2 packages. For example, you should be using imports like import { signIn } from 'aws-amplify/auth' instead of the older format.

  3. Verify that your auth configuration in your resource file (e.g., auth.ts) is set up correctly, especially the authorizationModes.

  4. If you're using custom groups (like an "admin" group), make sure your storage and other resource configurations include the necessary permissions for these groups.

  5. Check for any console errors or network requests that might provide more information about why the APIs are freezing.

  6. Ensure that you're handling the authentication flow correctly. After signUp, you may need to confirm the sign-up (if required) before you can use other auth APIs.

  7. If you're using NextJS server-side rendering, make sure you're not calling Amplify APIs on the server side unintentionally, as they are meant to be used on the client side.

If the issue persists after checking these points, you might want to try creating a minimal reproduction of the problem and seek further assistance from the Amplify community or AWS support.

Remember, Amplify Gen2 is still relatively new, so there might be some undocumented issues or best practices that are still evolving.

Sources
Amplify gen 2, amplify-authenticator "There is already a signed in user." | AWS re:Post
Sign-up - AWS Amplify Gen 2 Documentation
Issue with amplify gen2 file upload using Storage: access denied | AWS re:Post

answered 7 months ago
  • Already tried these things unfortunately.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.