question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] - [Analytics] - UpdateEndpoint is not send data

See original GitHub issue

Hi, I have a question about Analytics.updateEndpoint(), my case is:

  1. Configure Auth and Analytics properties in Amplify.configure on my startup file.
import Amplify, {
    Analytics
} from 'aws-amplify';

Amplify.configure({
    Auth: {
        region: process.env.REACT_APP_AWS_REGION,
        identityPoolId: process.env.REACT_APP_AWS_IDENTITY_POOL_ID,
        userPoolId: process.env.REACT_APP_AWS_USER_POOL_ID,
        userPoolWebClientId: process.env.REACT_APP_AWS_USER_POOL_CLIENT_ID,
    },
    Analytics: {
        AWSPinpoint: {
            region: process.env.REACT_APP_AWS_REGION,
            appId: process.env.REACT_APP_AWS_PINPOINT_APP_ID,
            mandatorySignIn: false
        }
    }
});
  1. After Amplify Login on Cognito UserPool I’m invoke the method Analytics.updateEndpoint() passing custom UserId and UserAttributes
Auth.currentUserInfo().then((info) => {

    Analytics.updateEndpoint({
        userId: info.attributes.sub,
        userAttributes: info.attributes
    }).then((data) => {
        dispatch(setProgress(false));
        dispatch({
            type: LOGIN_SUCCESS,
            user: data
        });
        dispatch(redirectTo('/'));
    });
}).catch(error => {
    dispatch(setProgress(false));
    dispatch({
        type: LOGIN_ERROR,
        error: error
    });
});

But when I invoke the method, on the Network tab on Google Chrome, the request is not there. I set up the Pinpoint to Stream events to Firehose and when I saw on S3 Files de userAttributes is empty and the UserId is not changing.

I would like to known if can I change endpoint Information after configure Amplify on startup?

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
temideoyecommented, Jan 7, 2019

@lucasvieirasilva, from what I see, you did everything right except that your endpoint needs an address. If your default config does not contain an endpoint address, you need to pass in one the first time you call updateEndpoint. You may try something like this:

Updating this for future reference userAttributes object expects array values. Right implementation should be:

Auth.currentUserInfo()
	.then(({ attributes }) => {
		const userAttributes = {};
		Object.entries(attributes).forEach(([key, value]) => {
			userAttributes[key] = [`${value}`];
		});
		Analytics.updateEndpoint({
			address: attributes.email, // Or phone_number
			channelType: 'EMAIL', // Or 'SMS'
			userId: attributes.sub,
			userAttributes
		});
	})
	.then(() => console.log('Do something else'));
2reactions
janhesterscommented, May 29, 2019

@madmed88 I think so, too. Made a detailed tutorial here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to properly configure Amplify Analytics? - Stack Overflow
After doing this, it seems to me that the data in the Pinpoint console is not accurate. For example, there are currently 44...
Read more >
pinpoint.updateEndpoint Giving error "NotFoundException
updateEndpoint Giving error "NotFoundException: Resource not found". -1. I am trying to create a dynamic segment in amazon pinpoint and then add endpoints....
Read more >
Endpoint - Amazon Pinpoint - AWS Documentation
An endpoint represents a destination that you can send messages to, such as a mobile device, email address, or phone number.
Read more >
AWS-Amplify/Lobby - Gitter
Everything works fine - except that the email address of the user (which I update using Analytics.updateEndpoint(...) is not contained in the Kinesis...
Read more >
Tracking and Reminders in AWS Amplify
Understand with Analytics and engage with AWS Pinpoint. ... Track which features your users use in AWS Amplify and send them emails, push-notifications...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found