aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Pinpoint: removeAttributes API not deleting the user attributes

Open deepakpc opened this issue 5 years ago • 21 comments

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug I have been trying the removeAttributes API for Pinpoint to remove a specific user attribute from all the endpoints. But, whenever I call this API, I get a response with blacklisted attributes which are all the fields except for what I have given in the request. But, when I get the endpoint using getEndpoint, I can see all the attributes intact. I tried updating to the latest version of the SDK. But nothing changed.

Is the issue in the browser/Node.js? Node.js

If on Node.js, are you running this on AWS Lambda? Yes

Details of the browser/Node.js version Paste output of npx envinfo --browsers or node -v Using the Node.js 10.x Runtime for Lambda

SDK version number v2.643.0

To Reproduce (observed behavior)

const params = {
        ApplicationId: 'Pinpoint-AppId', /* required */
        AttributeType: 'endpoint-user-attributes', /* required */
        UpdateAttributesRequest: { /* required */
            Blacklist: ['uuid1(user-attribute-1)', 'uuid2(user-attribute-2)']
        }
};
const removeAttributesResp = await pinpoint.removeAttributes(params).promise();

Expected behavior It should delete the user attributes given in the 'Blacklist' field from all endpoints.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

deepakpc avatar Mar 24 '20 03:03 deepakpc

Have you followed the steps to use the latest SDK when working with Lambda?

Can you please check the version by printing the output of AWS.VERSION in your code where you have AWS = require("aws-sdk");

It might be the case that you are using an older version of the SDK if you have not bundled the SDK to use in your application.

ajredniwja avatar Mar 25 '20 22:03 ajredniwja

@ajredniwja I'm using a Lambda Layer with the latest version of aws-sdk. The output of AWS.VERSION is 2.646.0. Updated and tried today. Not working still.

deepakpc avatar Mar 26 '20 05:03 deepakpc

@deepakpc In order for removeAttribute to work with blacklisted attribute you have to specify exact name of each attribute to remove or the Blacklist array can specify a glob pattern that an attribute name must match in order for the attribute to be removed. Can you make sure that you are sending the attribute in correct pattern?

https://docs.aws.amazon.com/pinpoint/latest/apireference/apps-application-id-attributes-attribute-type.html#apps-application-id-attributes-attribute-typeput

ajredniwja avatar Mar 30 '20 23:03 ajredniwja

@ajredniwja Yes. I am sending the exact attribute name in the Blacklist array. In my case, the attribute name that I gave is a UUID. For example: "081fb620-7244-11ea-a350-b7f82e08a699".

deepakpc avatar Mar 31 '20 03:03 deepakpc

@ajredniwja Any new updates on this issue?

deepakpc avatar May 16 '20 10:05 deepakpc

I have exactly the same problem.

The docs are wrong - they claim that it should return the removed attributes but in fact it returns the remaining attributes.

I have tried this operation using the:

  1. AWS Java SDK
  2. AWS CLI
  3. AWS REST API

The results are identical in every case.

Please can we get an update on this?

fotherda71 avatar Jul 08 '20 20:07 fotherda71

@fotherda71 @deepakpc Hey guys, were you able to resolve this issue? I notice the same in Python boto SDK.

pnikhil avatar Aug 14 '20 18:08 pnikhil

@fotherda71 @deepakpc Hey guys, were you able to resolve this issue? I notice the same in Python boto SDK.

No. I had contacted AWS developer support and they said it was an issue on their end after contacting the Pinpoint development team. They suggested me a "workaround" which was to delete the endpoints that have the attributes to be removed and re-create them without those attributes.

deepakpc avatar Aug 14 '20 18:08 deepakpc

@deepakpc Oh, alright! Thank you for your quick response 👍

pnikhil avatar Aug 14 '20 18:08 pnikhil

Any update on this one? We are discovering this now and it is becoming a pretty urgent issue for us as we need to remove stale attributes from all our users and it is not feasible to do it on a user by users basis as we have millions of endpoints.

edvanr avatar Jul 08 '21 01:07 edvanr

@edvanr reaching out to the pinpoint team to see what the issue was and whats going on.

P49565825

ajredniwja avatar Jul 08 '21 04:07 ajredniwja

@ajredniwja Will this get fixed any time soon or is the Pinpoint team still figuring out what is going on?

deepakpc avatar Dec 20 '21 10:12 deepakpc

Pinpoint team was able to provide a workaround but not an idle solution, please see if this works for you.

You follow the following sequence of commands:

  1. Create a test endpoint with "UserAttributes.subscriptions" as a user attribute:
aws pinpoint update-endpoint --cli-input-json '{
  "ApplicationId": "xyz",
  "EndpointId": "endpoint-test",
  "EndpointRequest": {
    "Address": "[email protected]",
    "User": {
      "UserAttributes": {
        "subscriptions": ["prime" ],
        "topics": ["science", "politics", "cats", "dogs"]
      }
    },
    "ChannelType": "EMAIL"
  }
}'
  1. Remove all values for the user attribute "subscriptions". Note that excluding "subscriptions" itself without the empty list will NOT remove any values for subscriptions nor will it remove the attribute.
aws pinpoint update-endpoint --cli-input-json '{
  "ApplicationId": "xyz",
  "EndpointId": "endpoint-test",
  "EndpointRequest": {
    "Address": "[email protected]",
    "User": {
      "UserAttributes": {
        "subscriptions": [],
        "topics": ["science", "politics", "cats", "dogs"]
      }
    },
    "ChannelType": "EMAIL"
  }
}'
  1. If you want to remove the "subscriptions" attribute entirely, first delete the endpoint:
aws pinpoint delete-endpoint --application-id xyz --endpoint-id endpoint-test
  1. Then recreate it, without the "subscriptions" attribute:
aws pinpoint update-endpoint --cli-input-json '{
  "ApplicationId": "xyz",
  "EndpointId": "endpoint-test",
  "EndpointRequest": {
    "Address": "[email protected]",
    "User": {
      "UserAttributes": {
        "topics": ["science", "politics", "cats", "dogs"]
      }
    },
    "ChannelType": "EMAIL"
  }
}'

ajredniwja avatar Dec 28 '21 23:12 ajredniwja

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] avatar Jan 03 '22 00:01 github-actions[bot]

@ajredniwja I understand what the Pinpoint team is trying to provide as a workaround. When I try to update an endpoint with an empty array, it is working fine for an endpoint.

But, the real issue is not that. The "removeAttributes" API is for removing that attribute from all the endpoints within that Pinpoint Application. With this workaround, we need to get the endpoints and update them one by one. But, the AWS-SDK for Javascript only has "getEndpoint" API, which is only to get a single endpoint. There is no way to get a list of the endpoints other than doing a "createExportJob". This makes the suggested workaround very hard to achieve in a large project in real-time.

Is there any suggestion on the exact issue?

deepakpc avatar Jan 03 '22 05:01 deepakpc

Is there an update on this? I'm having the exact same problem with custom endpoint attributes using boto3.

vrieni avatar Feb 24 '22 01:02 vrieni

Any updates? Still experiencing the same issue that other users have pointed out above.

adrian5991 avatar Sep 02 '22 18:09 adrian5991

Any updates? Still experiencing the same issue that other users have pointed out above.

mint673 avatar Oct 23 '22 03:10 mint673

This is still an issue as we ran into this.

longility avatar Jan 12 '23 18:01 longility

We are facing the limit of attributes in production and getting this error:

ERROR	BadRequestException: Too many total additional attributes

The workaround mentioned before of deleting all users and reinsert is not doable for us. Please fix this issue asap.

In the mean time we are requesting to increase the soft limit from 250 to 500. But seems like this change is not instantly that require code push from the AWS team and require a few days to apply it.

stwonary avatar Feb 21 '23 14:02 stwonary

Still having this issue in 2023. I fail to understand what does removeAttributes function even do at this point.

AleksandarGT avatar May 10 '23 15:05 AleksandarGT