You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently working with QLDB -> Kinesis stream -> AWS lambda (node.js 18+) and I am encountering the following when loading an ion record in the lambda:
"errorType": "Runtime.UnhandledPromiseRejection","errorMessage": "TypeError: The encoded data was not valid for encoding utf-8","reason": {"errorType": "TypeError","errorMessage": "The encoded data was not valid for encoding utf-8","code": "ERR_ENCODING_INVALID_ENCODED_DATA",
Package versions are:
"ion-js": "^4.3.0","jsbi": "^4.3.0"
Here is an example code to reproduce this issue:
import{load}from'ion-js';constdata="84mawgpANDk2ZTVmYzM4NmUwZjU3ZTQ1MmFjM2U0OWI0NWE1NDUwYjU5MGQ1OWI1ZjI2Mzg3MDQyYzBhMTEzNzVhYTQ4MQpANDljNmM0MzE2Y2Q2YzlkNjM0Zjk0N2FkNzA1NjVkYjYxZmU0MmE4ODI1ZmU1MmYxMWM2YzVjYTYwNmE0ZDc0ZhrhCAgAGtwI4AEA6u4Cu4GD3gK2h74Cso1xbGRiU3RyZWFtQXJuinJlY29yZFR5cGWHcGF5bG9hZIxibG9ja0FkZHJlc3OIc3RyYW5kSWSKc2VxdWVuY2VOb410cmFuc2FjdGlvbklkjo5ibG9ja1RpbWVzdGFtcIlibG9ja0hhc2iLZW50cmllc0hhc2iOkXByZXZpb3VzQmxvY2tIYXNojo9lbnRyaWVzSGFzaExpc3SOj3RyYW5zYWN0aW9uSW5mb4pzdGF0ZW1lbnRziXN0YXRlbWVudIlzdGFydFRpbWWOj3N0YXRlbWVudERpZ2VzdIlkb2N1bWVudHOOlkFkM0FXYlpQNnp1OUhFVGROZzZwcEGJdGFibGVOYW1lh3RhYmxlSWSOkXJldmlzaW9uU3VtbWFyaWVzhGhhc2iKZG9jdW1lbnRJZN4Gl4qOzGFybjphd3M6cWxkYjp1cy1lYXN0LTE6MDEzMjQyMTkwMTg0OnN0cmVhbS9zdGctT3JkZXJzL0tyVTVjVXpkVzM1S0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OTAxYzQ5MDM4MDGdikJyYXZvIFRpbGWeIJ8goIChgKKAoyMBhqCkSEAVAAAAAAAApSCmIKeOpDYwOGFjZTI0LWY1MGItNDdmYy04MzdkLWE4NDlmNWI4MzFhZKiOlmFkbWluQGFyY2FkaWFmdW5kcy5jb22pjpgyMDIzLTA0LTEzVDIwOjAxOjM0LjcwOFqqjpZBZDNBV2JaUDZ6dTlIRVRkTmc2cHBBqyECrI6YMjAyMy0wNC0xNVQxOTo1NjozNS4zNjFarY6Wb21hY2lAYXJjYWRpYWZ1bmRzLmNvba7esq8hA6mOmDIwMjMtMDQtMTVUMDQ6MDA6MDAuMDAwWrBIQC0qqqqqqqukSEAVAAAAAAAAsd7Cqo6WQWQzQVdiWlA2enU5SEVUZE5nNnBwQYUhLbJrgA/nhI+TuKLDAIKzjpYydXl4WjBZOHk3NDRuT09ydURodWJq5Zv539x9CYjfG+BB7dduxQ==";constres=Buffer.from(data,'base64')constionRecord=load(res);// Error is throw here
This issue happens intermittently as well. Any help or insight would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
Your base64 data does not start with the Ion Version Marker (IVM), so your data is not Ion binary format. Therefore, the load function assumes that you are trying to provide UTF-8 encoded Ion text, which is why you get a UTF-8 encoding error.
That being said, there is an IVM that occurs after the first 144 bytes. After dropping the first 144 bytes, you can see your Ion data by running:
echo "4AEA ..." | base64 -d | ion dump
I do not know how it is that you ended up with non-Ion data around the Ion data, but hopefully this information helps you find out where the problem is introduced.
The non-Ion data is probably being added as a wrapper around your Ion data in one of the steps between QLDB and your application, not by QLDB itself. I would start by looking at whether Kinesis and/or Lambda adds any metadata or wrappers to event data.
I am currently working with QLDB -> Kinesis stream -> AWS lambda (node.js 18+) and I am encountering the following when loading an ion record in the lambda:
Package versions are:
Here is an example code to reproduce this issue:
This issue happens intermittently as well. Any help or insight would be greatly appreciated.
The text was updated successfully, but these errors were encountered: