I moved a functioning project to a new machine and followed the suggested steps for reinitializing the awsmobile project by linking it to the existing mobile hub project.
Everything seemed to go as expected except signing in results in a "No userPool" error message.
I've looked at the other related overflow questions and they don't seem to apply.
I connected to the existing mobile hub project via the following command:
awsmobile init <mobile hub project GUID>
Which ended with "Successfully linked AWS Mobile Hub project: ".
The config file being loaded by amplify is as follows (it was also auto generated by the awsmobile init):
const awsmobile = {
'aws_app_analytics': 'enable',
'aws_auth_facebook': 'enable',
'aws_cognito_identity_pool_id': '<value here removed>',
'aws_cognito_region': '<value here removed>',
'aws_content_delivery': 'enable',
'aws_content_delivery_bucket': '<value here removed>',
'aws_content_delivery_bucket_region': '<value here removed>',
'aws_content_delivery_cloudfront': 'enable',
'aws_content_delivery_cloudfront_domain': '<value here removed>',
'aws_facebook_app_id': '<value here removed>',
'aws_facebook_app_permissions': 'public_profile',
'aws_mobile_analytics_app_id': '<value here removed>',
'aws_mobile_analytics_app_region': '<value here removed>',
'aws_project_id': '<value here removed>',
'aws_project_name': '<value here removed>',
'aws_project_region': '<value here removed>',
'aws_resource_name_prefix': '<value here removed>',
'aws_sign_in_enabled': 'enable',
'aws_user_pools': 'enable',
'aws_user_pools_id': '<value here removed>',
'aws_user_pools_web_client_id': '<value here removed>',
}
Any advice? Things I can look into?
(Also previous machine died and AWS suggests you don't check the config objects into source control. So I can't compare the current config files for delta's with the previous machine. )
Thanks!
edited to fix format error and some grammatical clarity upon proof reading
After stepping through the withAuthenticator HOC and its use of the AuthClass object in aws-amplify/Auth/Auth.js it turns out the issue is actually related to a stack overflow question:
AWS Amplify: How to setup { withConnector } component?
That solution mentions looking for a duplicate aws-amplify installation in the node_modules under aws-amplify-react. My particular implementation is react native and so I looked under aws-amplify-react-native and, sure enough, it had a node_modules with aws-amplify. Deleting that made the solution work.
This is because amplify is being configured in the App.js file. But the withAuthenticator HOC loads from aws-amplify-react-native which would first use the Auth object from its own node_modules which was never configured.