Skip to content
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

Authorization for Analytics fails with "No userpool" #229

Closed
floric opened this issue Feb 3, 2018 · 12 comments
Closed

Authorization for Analytics fails with "No userpool" #229

floric opened this issue Feb 3, 2018 · 12 comments
Labels
bug Something isn't working

Comments

@floric
Copy link

floric commented Feb 3, 2018

Hey,

I currently tried to upgrade from 0.1.x to 0.2.3 (also tried 2.0.0).
Unfortunately, the logging of metrics to Pinpoint doesn't work anymore. Somehow the initialization of Analytics fails already.
In "currentUserCredentials()" it rejects the "currentUser()" in Auth.ts promise with "No userPool". This will lead to "credentialsOK" in Analytics.ts to be false and so prevent Mobile Analytics and Pinpoint from getting initialized. But I'd like to collect metrics for unauthorized users of course and so I think I don't need a user pool for this.

Is this an expected behavior? There is no error output in the console.
I also double checked the configuration and it worked before the same in 0.1.x.

Thanks :)
Florian

@mlabieniec
Copy link
Contributor

@floric are you using react native or web/js? If React Native, you need to update imports to import from 'aws-amplify' no long er 'aws-amplify-react-native' (this is only for HOCs and components now).

Also, if in an existing project you may need to delete your node_modules and npm install

@mlabieniec mlabieniec added the investigating This issue is being investigated label Feb 3, 2018
@floric
Copy link
Author

floric commented Feb 3, 2018

Hey, sorry for missing the information: building a web SPA with "aws-amplify@0.2.3" using Yarn, also double checked this already (looking into the yarnlock and the node_modules folder)

I debugged the code as described above. Might be important as well, that in Auth in "essentialCredentials(credentials)", credentials is null and so credentials.accesskeyId will lead to an exception.

@mlabieniec
Copy link
Contributor

We have seen some issues with yarn that we are looking into still, can you give npm install a try just to eliminate this possibility?

@floric
Copy link
Author

floric commented Feb 3, 2018

Of course :) Tested using NPM 5.3.
But didn't change anything. I'll try to examine the bug and see if I can fix it.

@mlabieniec
Copy link
Contributor

Are you including the aws-js-sdk in your project as well? If so, can you verify the version you have in node_modules

@floric
Copy link
Author

floric commented Feb 3, 2018

aws-sdk: It's not part of my package.json but 2.177.0 is included in Yarn as well as NPM. Should be enough, right?

@mlabieniec
Copy link
Contributor

Yes that's right I just wanted to make sure that was the version since the later one has a breaking change with the cognito library.

@mlabieniec
Copy link
Contributor

Did you create your backend through Mobile Hub or via the awsmobile-cli? Or did you manually setup your resources?

@floric
Copy link
Author

floric commented Feb 3, 2018

At first I manually integrated aws-amplify based on the manual instructions and an existing project.
After the same problems using 0.2.0 as mentioned in this thread, I used awsmobile-cli to create a new Mobile Project. This used aws-amplify@0.1.36 which worked, but my custom events were not visible in Mobile Analytics so I tried to update to 0.2.x. The resources seem to work correctly as they are a standard project created with Mobile CLI using only analytics and I was able to see events and users in Pinpoint using 0.1.36 as well as the REST calls in Chrome.

@mlabieniec mlabieniec added bug Something isn't working and removed investigating This issue is being investigated labels Feb 3, 2018
@mlabieniec mlabieniec mentioned this issue Feb 3, 2018
mlabieniec added a commit that referenced this issue Feb 9, 2018
* update quickstart

* update docs index with examples

* Update index.md

* fix retrieve unauth credentials if not logged in, Fixes #229

* fix docs #238

* update details around react-native hocs

* update signUp api description

* updates based on review
@jacklinton
Copy link

jacklinton commented Feb 16, 2018

I'm still having this "credentials.accesskeyId" being undefined problem. It started with APIs I created myself through the command line and now it continues with an imported cloud logic service created outside of Mobile Hub. I haven't successfully connected to any API. First I a warning about it in the console and then I directly tried to run Auth.essentialCredentials() and got an unhandled promise warning because credentials.accesskeyId undefined is not an object. This is all post-logging in.

Amplify 0.2.6
React native is the ExpoSDK25.0.0 build and same version of expo.

@hsavit1
Copy link

hsavit1 commented Sep 11, 2018

Try checking for duplicate node_modules installations. check for node_modules in the library aws-amplify-react and if it's there, delete it

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants