aws-samples / aws-samples/lambda-refarch-streamprocessing
Buffer should convert to UTF8 not ASCII
- Dominant language
- JavaScript
- Stars
- 344
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
I think [line 37](https://github.com/awslabs/lambda-refarch-streamprocessing/blob/master/ddb_eventprocessor.js#L37) should be rewritten as `payload = new Buffer(record.kinesis.data, 'base64').toString('utf8');`
I recently ran into a situation where I could not for the life of me figure out why I kept getting this mysterious `unexpected token error` in Lambda's Cloudwatch console. After a few hours of testing and debugging, I finally figured out that I was passing invalid JSON Control Characters. BUT, what was really happening was I was converting chinese characters to ASCII.
The standard should be UTF8 to support our global connectivity 😉 .
Contributor guide
Research direction
Start at line 37 of ddb_eventprocessor.js and inspect how the Kinesis payload is decoded before JSON processing. Confirm the change by checking that payloads containing Chinese or other non-ASCII characters are preserved and no longer produce invalid JSON control-character errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100