Closed pssheehy closed 1 year ago
Thank you for opening this issue. Are you following the automated or manual instructions when this error happens?
I'll also review the path to DynamoDB to see if a change was made related to this key.
Manual path...I updated the variable to a string and then it started puking on friendlyName as a key....trying to track down where the real problem is. My new hire in SJC ran into the same problem with it, she is also digging in. You can reach out to my internal email if you prefer
Patrick
Pa
On Wed, Feb 6, 2019 at 10:15 AM Mike Maas notifications@github.com wrote:
Thank you for opening this issue. Are you following the automated or manual instructions when this error happens?
I'll also review the path to DynamoDB to see if a change was made related to this key.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alexa/skill-sample-python-smarthome-sandbox/issues/6#issuecomment-461128398, or mute the thread https://github.com/notifications/unsubscribe-auth/As-VfDKyNOuu6DJp_xljXrQhn3psE0NKks5vKxu1gaJpZM4akV2u .
Narrowed down in debugging to misconfigurations in CFT and json error on Cloudwatch output.
1) Missing LambdaExecutionRole permission for iot:CreateThingType 2) DynamoDB SampleEndpointDetails key is DetailsId in CFT but is expected to be EndpointId in the python scripts for Lamda 3) Lambda is erroring out on line 225 of api_handler_directive.py based on unexpected JSON, Not sure what the issue is on this one...I commented out the line which is just a debug output command to CloudWatch
a. print(json.loads(response_update)) b. the JSON object must be str, bytes or bytearray, not 'dict': TypeError Traceback (most recent call last): File "/var/task/index.py", line 73, in handler response = api_handler.directive.process(request, env_client_id, env_client_secret, get_api_url(env_api_id, env_aws_default_region, 'auth-redirect')) File "/var/task/endpoint_cloud/api_handler_directive.py", line 226, in process print(json.loads(response_update)) File "/var/lang/lib/python3.6/json/init.py", line 348, in loads 'not {!r}'.format(s.class.name)) TypeError: the JSON object must be str, bytes or bytearray, not 'dict' c. {'ResponseMetadata': {'RequestId': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'HTTPStatusCode': 200, 'HTTPHeaders': {'content-type': 'application/json', 'content-length': '129', 'date': 'Thu, 07 Feb 2019 01:43:21 GMT', 'x-amzn-requestid': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'connection': 'keep-alive'}, 'RetryAttempts': 0}, 'payload': <botocore.response.StreamingBody object at 0x7fc206fae860>}
Narrowed down in debugging to misconfigurations in CFT and json error on Cloudwatch output.
1. Missing LambdaExecutionRole permission for iot:CreateThingType 2. DynamoDB SampleEndpointDetails key is DetailsId in CFT but is expected to be EndpointId in the python scripts for Lamda 3. Lambda is erroring out on line 225 of api_handler_directive.py based on unexpected JSON, Not sure what the issue is on this one...I commented out the line which is just a debug output command to CloudWatch
a. print(json.loads(response_update)) b. the JSON object must be str, bytes or bytearray, not 'dict': TypeError Traceback (most recent call last): File "/var/task/index.py", line 73, in handler response = api_handler.directive.process(request, env_client_id, env_client_secret, get_api_url(env_api_id, env_aws_default_region, 'auth-redirect')) File "/var/task/endpoint_cloud/api_handler_directive.py", line 226, in process print(json.loads(response_update)) File "/var/lang/lib/python3.6/json/init.py", line 348, in loads 'not {!r}'.format(s.class.name)) TypeError: the JSON object must be str, bytes or bytearray, not 'dict' c. {'ResponseMetadata': {'RequestId': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'HTTPStatusCode': 200, 'HTTPHeaders': {'content-type': 'application/json', 'content-length': '129', 'date': 'Thu, 07 Feb 2019 01:43:21 GMT', 'x-amzn-requestid': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'connection': 'keep-alive'}, 'RetryAttempts': 0}, 'payload': <botocore.response.StreamingBody object at 0x7fc206fae860>}
Did you sort out this issue? I am experiencing the same errors. Help if you can, thanks.
Narrowed down in debugging to misconfigurations in CFT and json error on Cloudwatch output.
1. Missing LambdaExecutionRole permission for iot:CreateThingType 2. DynamoDB SampleEndpointDetails key is DetailsId in CFT but is expected to be EndpointId in the python scripts for Lamda 3. Lambda is erroring out on line 225 of api_handler_directive.py based on unexpected JSON, Not sure what the issue is on this one...I commented out the line which is just a debug output command to CloudWatch
a. print(json.loads(response_update)) b. the JSON object must be str, bytes or bytearray, not 'dict': TypeError Traceback (most recent call last): File "/var/task/index.py", line 73, in handler response = api_handler.directive.process(request, env_client_id, env_client_secret, get_api_url(env_api_id, env_aws_default_region, 'auth-redirect')) File "/var/task/endpoint_cloud/api_handler_directive.py", line 226, in process print(json.loads(response_update)) File "/var/lang/lib/python3.6/json/init.py", line 348, in loads 'not {!r}'.format(s.class.name)) TypeError: the JSON object must be str, bytes or bytearray, not 'dict' c. {'ResponseMetadata': {'RequestId': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'HTTPStatusCode': 200, 'HTTPHeaders': {'content-type': 'application/json', 'content-length': '129', 'date': 'Thu, 07 Feb 2019 01:43:21 GMT', 'x-amzn-requestid': 'dbc584bf-5f7f-ed99-17e8-cffb0252505d', 'connection': 'keep-alive'}, 'RetryAttempts': 0}, 'payload': <botocore.response.StreamingBody object at 0x7fc206fae860>}
Did you sort out this issue? I am experiencing the same errors. Help if you can, thanks.
I did sort it out by making the three changes articulated and I did a commit with those changes to the mainline so you should already have the fixes I added.
@pssheehy, @mikemaas-amazon The changes made are reflected on: https://github.com/alexa/skill-sample-python-smarthome-sandbox/blob/master/cloudformation/backend.template
However this is not the same file that is mentioned in Step 2.1.3 (https://s3.amazonaws.com/endpoint-code-us/backend.template) Maybe change the s3 URL for the github path with the updated template. With the s3 file you run into IAM error and have to add permissions there and also the DetailsId Key error on DynamoDB
This is answered by community
getting validation error from DynamoDB on primary key for SampleEndpointDetails table. updated line 168 in my clone from: 'EndpointId': endpoint_details.id
to: 'EndpointId': endpoint_details.user_id
That stopped the errors from Dynamo, though I am not convinced it is the correct solution...I couldn't find a .id attribute in the object passed to the function and the key required a string so I used the user_id which was passed.