Closed ramon-san closed 1 month ago
The above problem was solved by removing the amazon-cognito-identity-js
library from the project.
Quick question: Is Amplify the best/easiest way to connect to Cognito? It feels like a lot of overhead for a project that doesn't use all the other Amplify features. Any recommendations on the best way to access Cognito without having to recreate all API requests?
@ramon-san Thank you for your report! Removing amazon-cognito-identity-js
is indeed the solution for the original problem you reported. We do recommend that customers use the Amplify JS v6 Auth category for interacting with Cognito. Any unused functionality should be tree-shaken out of your application bundles when using the default Next.js configuration.
@ramon-san just to add to what @jimblanc stated above, we've updated the README for the amazon-cognito-identity-js
package as well to state that we recommend using Amplify v6 going forward. Feel free to follow our docs on how to implement the Auth category easily into your app here and let us know if there are any further questions!
Awesome, thanks guys (@jimblanc, @cwomack)! Already implemented Auth with Amplify and it works great, super good developer experience, congrats!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
None
Environment information
Describe the bug
I have a Next.js project using the
amazon-cognito-identity-js
library. This has become a nightmare because there is essentially no documentation for the library (I can't find this anywhere and don't know how it maps to Amplify). Aside from this, the library now has this message:Given this I decided to install Amplify to my project with this command:
After installing the project I created the following config file:
This function is imported into my
_app.tsx
file:After adding the config setting I get this error:
When the app runs without this it works just fine.
Expected behavior
I was expecting the library to not cause problems.
Reproduction steps
Reproduction could probably be done with this template: https://github.com/ramon-san/next-template. The website I am currently building originally comes from this template.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
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
I am simply looking for a library that makes handling Cognito requests simple, if there is a more vanilla way of doing this without installing Amplify please let me know.