Amplify auth configuration error AWSPinpointProvider - updateEndpoint error TypeError: Object(...) is not a function

Viewed 669

What I want to achieve?

I want to integrate the aws analytics in my web application that can track user experience. AWS requires you to work with the library Amplify to record events in your react web app.

What I have done so far?

I have configured the aws amplify cli. I have configured the auth and analytics according to the instructions here. I have created a pool identity and gave permissions to its unAuth role via privacy policy. I am giving the right Identity pool Id in my code.

Problem I am facing

When I configure Analytics or try to record event it keeps giving me the error.

Credentials - Error loading credentials TypeError: Object(...) is not a function

AWSPinpointProvider - set credentials for analytics TypeError: Object(...) is not a function

Code

import Analytics from '@aws-amplify/analytics';
import Amplify from '@aws-amplify/core';
import Auth from '@aws-amplify/auth';
    Amplify.Logger.LOG_LEVEL = 'DEBUG'
    const amplifyConfig = {
        Auth: {
          identityPoolId: <id>,
          region: 'us-east-1'
        }
      }
      Auth.configure(amplifyConfig);
      
      const analyticsConfig = {
        AWSPinpoint: {
              appId: <app Id>,
              region: 'us-east-1',
              mandatorySignIn: false,
        }
      }
      Analytics.configure(analyticsConfig)
      Analytics.record({ name: 'event-name', attributes: { property1: 'one' } });

How can we properly configure analytics and auth to record events via amplify. Any help would be appreciated.

0 Answers
Related