-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Shouldn't PinPoint send Analytics with UserID as cognito:sub instead of IdentityID? #1779
Comments
@mihaiblaga89 Amplify has this automatic tracking feature which will update the endpoint automatically and for now the user Id by default would be the identity id from the aws credentials. We will talk to Pinpoint and Cognito team about the correct way to set the default user Id. As for now you can try a work around which is to turn off that autotracking feature by setting the |
Apparently according to the docs Cognito should add the phone and email as endpoints in Pinpoint automatically but that does not happen. Can't add a photo from mobile so I'll post a quote and a link. I'd rather not disable autoSession, I'll make a fork and call Auth.currentAuthenticatedUser() method in PinpointProvider._updateEndpoint() and use the user's sub value as Userid and if no user is logged in I'll default to your currently implemented solution while I wait for your fix. P.S. On mobile, might not remember the method names correctly. P.P.S. I've also discovered that on some calls the Demographics properties set manually in config like appVersion, etc are not taken into account. And if I remember correctly it happens only in the autoSession updates. |
I just ran into the same problem with the Storage module. It definitely doesn't seem correct to create user-level S3 folders per user-session. The folders should be created per user rather than per user-session; each user should only have one root folder for storage. Storage and Pinpoint are different, but the distinction between If Amplify somehow manages identity tracking under the hood, I would point out that this makes manual backend configuration really challenging. I'd like to use Amplify as the client but use manually created backend services like S3 and Pinpoint. If the client is too complicated then that complicates backend development. |
@ajhool I've managed to fix my issue but I won't be making a PR because it's pretty hack-ish. I basically called Waiting for a more elegant and clean way of doing it. As for identityId, what I've debugged so far is that our issue is somewhere in |
@powerful23 any updates on this? |
We have a story in our backlog to address this awaiting review |
@mlabieniec would you please consider attaching #1787 to that story? It's a similar conceptual issue but refers to Storage/S3 instead of Pinpoint. Storage also uses identityId rather than cognito:sub |
@mlabieniec @powerful23 any updates on this? Thanks |
@mihaiblaga89 hey we recently merged a pr to allow users to define the default endpoint context in the configuration of Analytics. So if you could pass your specified https://aws-amplify.github.io/docs/js/analytics#manual-setup |
Sorry for the late reply, missed the email. In theory, it should, but I'll check it when I get back to that task again because at the moment it's on the back burner. Will keep you posted. |
@powerful23 Are you suggesting that we re-call |
@powerful23 I need to send push notifications to specific user from my backend. How can I achieve this ? |
@amilaDulanjana hi because Amplify is mainly focusing on the frontend so I am not the expert to answer this. Can you go to the AWS Forum: https://aws.amazon.com/premiumsupport/knowledge-center/send-feedback-aws/ and open an issue there which is a more efficient way. |
@powerful23 No I cannot registered the user with the userId I am using following code. is there any issue with the code ? And also how can I know whether the user is registered with the provided userId. Thanx import { Logger } from 'aws-amplify'; import config from './aws-exports' Auth.configure(config); export default class App extends Component { componentDidMount() {
} render() { |
this comment helped me do it: #2477 (comment) |
@mihaiblaga89 any update on this? |
Closing this issue due to inactivity. |
Any update? |
This problem is still occurring, using the default user id is not a workable solution because we'd have to call it early in the initialization process where the user id (Cognito sub) is not available. Calling Amplify.configure multiple times is also not very workable as it was generating invalid requests to the server from my brief tests. |
This is still an issue... I've tried initializing the endpoints with: 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((result) => {
console.log(result);
});
})
.then(() => console.log("Analytics endpoint updated"));
}) This adds users attributes into Pinpoint but when I go to test the transactional email templates, the email fails to send when specifying the Cognito User Sub as the Endpoint ID. |
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 |
** Which Category is your question related to? **
Amplify PinPoint
** What AWS Services are you utilizing? **
Amplify, Cognito, PinPoint
** Provide additional details e.g. code snippets **
![screenshot 2018-09-28 at 15 10 50](https://user-images.githubusercontent.com/4787898/46207757-1fda1580-c331-11e8-961c-7f2f099476be.png)
The issue goes like this:
I can't, for some reason, get phone numbers and emails from Cognito to PinPoint. Userpool analytics is on, sharing the data with Pinpoint, role is ok, etc, but nothing shows up in PinPoint.
Anyway, I'm now trying to do it manually (sms, email, push) by specifying the UserId as cognito:sub to match them. However, giving the fact that React Native Amplify Analytics remembers the EndpointID used, it triggers an automated updateEndpoint with the UserID as IdentityID and that basically overwrites my PushNotification manually sent update and giving the fact that I don't have a way of getting IdentityID myself on Cognito login or in the lambdas I can't switch to that one.
Why is it sending the IdentityID as UserID? Even in the documentation it says that UserID field should have the cognito:sub value.
The text was updated successfully, but these errors were encountered: