- 최신
- 최다 투표
- 가장 많은 댓글
Hi there,
I have checked the code in the example and event you are looking for is "Kinesis record event", here is an example from documentation:
https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html
You can create an example event for to test your Lambda function locally.
Kind regards,
Alex
Hello Thanks for sharing the test event, however please if you can run the code and test it, its giving that KeyError can you please check and validate code provided is correct? As its not recognizing 'Records' in the library for Python?
Regards, Anchal
Hi Again,
As you can see after the Kinesis Record, test event i run, the below error i get : { "fail_code": "decode data fail", "result": "fail", "ctrs_processed": 0, "ctrs_skipped": 0 }
Seems its giving payload error in the Lambda function provided?
Decode the data and parse the json
try:
payload = base64.b64decode(record['kinesis']['data'])
payload_data = json.loads(payload)
# Log a decode failure and break out of loop
except:
response.update({'fail_code':'decode data fail'})
response.update({'result':'fail'})
Please if you can help, will be apreciated.
Thanks, Anchal
관련 콘텐츠
- 질문됨 일 년 전
- AWS 공식업데이트됨 2년 전