Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

smarthome Action: onSync response is invalid (according to GCP logs explorer) #417

Open
rlbartle opened this issue Feb 21, 2021 · 1 comment

Comments

@rlbartle
Copy link

rlbartle commented Feb 21, 2021

The issue is that whatever the contents of a response may be, it is being rejected which also means the account linking fails.

The log shows the following message every time this happens:

{
  "insertId": "1uvc6nbg5w34z7a",
  "jsonPayload": {
    "syncLog": {
      "syncs": [
        {
          "requestId": "16538090895749715207",
          "status": "json_response_invalid_format",
          "httpLatencyMsec": "2082"
        }
      ]
    }
  },
  "resource": {
    "type": "assistant_action_project",
    "labels": {
      "project_id": "XXX"
    }
  },
  "timestamp": "2021-02-21T02:32:17.000194145Z",
  "severity": "ERROR",
  "logName": "projects/XXX/logs/assistant_smarthome%2Fassistant_smarthome_logs",
  "receiveTimestamp": "2021-02-21T02:32:17.000194145Z"
}

With the debug option of the smarthome object set to true, this is some example output tagged in the log as "Response":

{
    "status": 200,
    "headers": {
        "content-type": "application/json;charset=utf-8"
    },
    "body": {
        "requestId": "3168304628571660115",
        "payload": {
            "agentUserId": "c28834eee672",
            "devices": []
        }
    }
}

This is hosted on AWS Lambda API gateway - using the Node.js 14.x runtime and additional modules for the latest v3 AWS SDK.

@rlbartle
Copy link
Author

rlbartle commented Mar 2, 2021

Was able to get it working by configuring the API Gateway resource. Integration Response => Mapping Templates:
Integration-Response = $input.path('$.body')

There needs to be documentation of some kind to let us know what the expected configuration the api gateway should be.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant