Amplify-js: Data does not reach Aws Kinesis from React Native correctly

Created on 24 Apr 2020  路  5Comments  路  Source: aws-amplify/amplify-js

When i send data with:

```javascript
let datadummie = 'Hello World'
await Analytics.record({
data: datadummie,
streamName: 'ClientLoginStreamRN-dev'
}, 'AWSKinesis');

This is executed through a lambda that sends the data through python correctly, but when I deal with react native the data reaches me as:

In Cloudwatch of my lambda:
**15:34:35**
**Before decoding:** AAAAAAAAAAAAAAAA

My lambda decode is: 
```python
def decode(encoded_client):
    print("Before decoding: ", encoded_client)
    payload=base64.b64decode(encoded_client).decode("utf-8")
    print(payload)
    #payload=json.loads(payload)
    print("Decoded payload: " + str(payload))
    print('tipo:', type(payload))

    return payload

My kinesis job has data encryption disabled, so I don't know why amplify converts the data to "AAAAAAAAA".

Thanks.

To Reproduce
Steps to reproduce the behavior:
1.- Create a react native app
2.- Import aws-sdk and configure kinesis with amplify.
3.- Create Lambda where configure how trigger when kinesis take the data.
4.- Execute the sendData().

Expected behavior
It is hoped that through my lambda I can have the information I am sending in kinesis.

Analytics React Native to-be-reproduced

All 5 comments

@CthompsonCL, Amplify does not manipulate the data that you are sending, though it's possible that it got modified during some encoding in aws-sdk. Can you share which aws-amplify and aws-sdk versions you are using. And if you are using aws-amplify version 3, then can you try using version 2 and let us know if you see any difference?

I was able to reproduce this even in Web and identify the root cause. I have a PR out, will update when we do a release with the fix.

The fix is out on the unstable version of aws-amplify aws-amplify@unstable and will be available in stable release in next few days.

I am still experiencing this same issue. Has this been fixed in the newest version of amplify?

I still have the same problem only on a React-Native application.
image

With the same configuration everything is work on a web React app.
Any help please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

romainquellec picture romainquellec  路  3Comments

guanzo picture guanzo  路  3Comments

DougWoodCDS picture DougWoodCDS  路  3Comments

rygo6 picture rygo6  路  3Comments

benevolentprof picture benevolentprof  路  3Comments