amplify-js
amplify-js copied to clipboard
V6 is missing updateEndpoint()
Before opening, please confirm:
- [X] I have searched for duplicate or closed issues and discussions.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
Vue
Amplify APIs
Analytics
Amplify Categories
analytics
Environment information
# Put output below this line
Not relevevant
Describe the bug
Update endpoint in V5 is not included in V6. Is this a bug or is the a reason why it has been removed?
I can see that V6 uses updateEndpoint() internally in the function identifyUser()
so is should be possible to expose updateEndpoint()
?
This is the a relevant pull request for V5? #11330
Expected behavior
Have the same methods and options as in V5 to make migration more easy
Reproduction steps
Compare doc and code for analytics V5 vs v6
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
Update
identifyUser
in package aws-amplify/in-app-messaging
has all we need, except that channel is locked to CHANNEL_TYPE
which is IN_APP
Hi @bergmorten thank you for opening this issue. In V6 of the aws-amplify
library, the updateEndpoint method of Analytics has been deprecated and you should instead use identifyUser
as you mentioned. I'm curious to hear if there are any issues or limitations you are facing with this?
We need a function to add FCM/GCM tokens in order to send push messages. We do not want to use the in app messages because it is not supported in our region and we need a better control of the messages.
Analytics->identifyUser only stores userAttributes
from options, we need the address and channel field.
export const identifyUser = async ({
userId,
userProfile,
options,
}: IdentifyUserInput): Promise<void> => {
const { credentials, identityId } = await resolveCredentials();
const { appId, region } = resolveConfig();
const { userAttributes } = options ?? {}; // Does not destruct channel or address
updateEndpoint({
appId,
category: 'Analytics',
credentials,
identityId,
region,
userAttributes,
userId,
userProfile,
userAgentValue: getAnalyticsUserAgentString(AnalyticsAction.IdentifyUser),
});
};
Notification->identifyUser stores address
, but channel is fixed to IN_APP.
export const identifyUser = async ({
userId,
userProfile,
options,
}: IdentifyUserInput): Promise<void> => {
assertIsInitialized();
const { credentials, identityId } = await resolveCredentials();
const { appId, region } = resolveConfig();
const { address, optOut, userAttributes } = options ?? {};
updateEndpoint({
address,
channelType: CHANNEL_TYPE,
optOut,
appId,
category: CATEGORY,
credentials,
identityId,
region,
userAttributes,
userId,
userProfile,
userAgentValue: getInAppMessagingUserAgentString(
InAppMessagingAction.IdentifyUser
),
});
};
PushNotifications->identifyUser is probably what we should have used, but this is disabled (Only native apps?)
export const identifyUser: IdentifyUser = async () => {
throw new PlatformNotSupportedError();
};
And last:
https://github.com/aws-amplify/amplify-js/blob/main/packages/core/src/providers/pinpoint/apis/updateEndpoint.ts
has all the option but is not exposed.
@bergmorten, thank you for the detailed follow up. We've marked this as a bug due to the regression from a feature-parity standpoint migrating from v5. We'll update this issue with progress as we make it!
any update on this ?
Updating this issue to be a feature request, since the removal of the updateEndpoint method was intentional going to v6. However, we didn't fully consider the use case outlined by @bergmorten's comment above. We're still reviewing this for a fix/feature implementation, but wanted to at least give this update.
@cwomack any update on this?
We use pinpoint to send marketing e-mails so having the ability to set Address, ChannelType to EMAIL and OptOut to NONE would be great. Else we need to migrate back to v5.