amplify-js
amplify-js copied to clipboard
Amplify Personalize Record Events For MediaAutoTrack are Failing
Describe the bug MediaAutoTrack Events Using Amplify SDK version - 3.3.3,3.3.2 is triggering events to tracker but they are failing due to bad payload . See the Sample Request/Response section at the bottom
https://docs.amplify.aws/lib/analytics/personalize/q/platform/js#working-with-the-api https://aws.amazon.com/blogs/aws/amazon-personalize-is-now-generally-available/
To Reproduce Steps to reproduce the behavior:
- Record Event for MediaAutoTrack Using the Dom ID for video player
- Play the Video
- Check Tracker Events are sent to Personalize
- Check Request/Response in Developer Tools
- HTTP 400 Error Code
Expected behavior Events are successfully submitted . HTTP 200 response code for Put Events
Desktop (please complete the following information):
- OS: macOS Catalina
- Browser: Firefox
- Version: 68.8.0esr (64-bit)
Additional context
Sample Request
{
"eventList": [
{
"eventId": "01cfc340-0539-184387240-0526-11eb-aa3a-29f4dbbd8521",
"eventType": "TimeWatched",
"properties": "{\"itemId\":\"593\",\"timestamp\":139.472841,\"duration\":597,\"eventValue\":0.2336}",
"sentAt": 1601702130
},
{
"eventId": "01cfc340-0539-184387240-0526-11eb-aa3a-29f4dbbd8521",
"eventType": "TimeWatched",
"properties": "{\"itemId\":\"593\",\"timestamp\":139.472841,\"duration\":597,\"eventValue\":0.2336}",
"sentAt": 1601702130
},
{
"eventId": "01cfc340-0539-184387240-0526-11eb-aa3a-29f4dbbd8521",
"eventType": "TimeWatched",
"properties": "{\"itemId\":\"593\",\"timestamp\":139.472841,\"duration\":597,\"eventValue\":0.2336}",
"sentAt": 1601702130
},
{
"eventId": "01cfc340-0539-184387240-0526-11eb-aa3a-29f4dbbd8521",
"eventType": "TimeWatched",
"properties": "{\"itemId\":\"593\",\"timestamp\":139.472841,\"duration\":597,\"eventValue\":0.2336}",
"sentAt": 1601702130
}
],
"sessionId": "84387240-0526-11eb-aa3a-29f4dbbd8521",
"trackingId": "1b2644e0-5b91-4fd5-a92c-fdc56ee02e1d",
"userId": "12345678"
}
Sample Response
{"message":"timestamp is not allowed in properties. Please refer to documentation to include timestamp"}
Error x-amzn-ErrorType: InvalidInputException:http://internal.amazon.com/coral/com.amazonaws.services.personalize.events.exceptions/
Same issue on latest with @aws-amplify/analytics
v4.0.5
Editing the value to be TIMESTAMP
in the provider solves this issue. This begs the question: does the provider just need changed to TIMESTAMP
instead of timestamp
?
@agileurbanite - can this be handled as a bug by your team?
I've just run into this issue too...
@mauerbac - any update on a bug fix?
{"message":"timestamp is not allowed in properties. Please refer to documentation to include timestamp"}
Same issue on latest with
@aws-amplify/analytics
v4.0.5![]()
Editing the value to be
TIMESTAMP
in the provider solves this issue. This begs the question: does the provider just need changed toTIMESTAMP
instead oftimestamp
?
Did you find a workaround for this issue? Any chance you could share your workaround, if so?
https://github.com/aws-amplify/amplify-js/blob/main/packages/analytics/src/Providers/AmazonPersonalizeHelper/MediaAutoTrack.ts#L187-L192
Here is the problematic block of code. The timestamp
property is not allowed in properties
. Could you please rename timestamp
?
@josefaidt @mauerbac
@rkarthikr and @kylekirkby, this issue and the root problem appears to be the timestamp
property having improper casing (needs to be camelCase) as referenced above in the comments. We are currently reviewing/testing PR #10329 that should fix this and will update this issue upon merging it in.
@rkarthikr and @kylekirkby, this issue and the root problem appears to be the
timestamp
property having improper casing (needs to be camelCase) as referenced above in the comments. We are currently reviewing/testing PR #10329 that should fix this and will update this issue upon merging it in.
Hi @cwomack ,
Thanks for the update. It appears that PR #10329 has passed all tests. Any idea when this will be merged?
Cheers,
Kyle
With help from @jimblanc and @cwomack I was able to reproduce this problem. The PR to change the case didn't resolve the issue. Doing a bit more research, we identified that the Personalization service reserves the timestamp
field name for internal use. There is a blocklist of property field names that all result in errors like this.
I've created a PR to remove the timestamp
property from the Amplify request, which I have tested and confirmed resolves the error without removing any previously supported behavior. The timestamp
information will continue to be populated by the Personalization service for all successful requests.
I have also requested that the Personalization team add all blocklisted fields to their documentation.
The fix has been merged and released. To validate, I have upgraded my test app to aws-amplify
5.0.14 and @aws-amplify/analytics
6.0.14, which works without the error describe by this issue.
Based on this, I am resolving the issue. If you are still seeing problems after adopting the fixed package versions, let us know.
Thanks, Aaron