Parsing error due to invalid body ASK CLI

Viewed 192

Using ASK CLI, I'm trying to update my smart home skill manifest but I'm facing the below error.

ask smapi get-skill-manifest -s amzn1.ask.skill.6d0d22eb-d305-4caa-8921-503cb7827454 -p supreet > skill-manifest.json

I have just changed a spelling in the downloaded manifest.

ask smapi update-skill-manifest -s --manifest $(cat skill-manifest.json)

OR

ask smapi update-skill-manifest -s --manifest skill-manifest.json

"response": {
      "message": "Request is not valid.",
      "violations": [
        {
          "code": "INVALID_REQUEST_PARAMETER",
          "message": "Parsing error due to invalid body.",
          "validationDetails": {
            "originalInstance": {
              "type": "BODY"
            },
            "reason": {
              "type": "MALFORMED_INPUT"
            }
          }
        }
      ]
    }

Here's the skill-manifest.json

{
  "manifest": {
    "apis": {
      "smartHome": {
        "endpoint": {
          "uri": "<arn>"
        },
        "protocolVersion": "3"
      }
    },
    "manifestVersion": "1.0",
    "permissions": [
      {
        "name": "alexa::async_event:write"
      }
    ],
    "privacyAndCompliance": {
      "allowsPurchases": false,
      "containsAds": false,
      "isChildDirected": false,
      "isExportCompliant": true,
      "locales": {
        "en-IN": {
          "privacyPolicyUrl": "https://www.privacyyyyyyypolicy.net",
          "termsOfUseUrl": "https://www.termsofuse.net"
        }
      },
      "usesPersonalInfo": false
    },
    "publishingInformation": {
      "automaticDistribution": {
        "isActive": false
      },
      "category": "SMART_HOME",
      "distributionCountries": [],
      "distributionMode": "PUBLIC",
      "isAvailableWorldwide": true,
      "locales": {
        "en-IN": {
          "description": "Test",
          "examplePhrases": [
            "test"
          ],
          "keywords": [
            "test"
          ],
          "largeIconUri": "<logo-url>",
          "name": "Test",
          "smallIconUri": "<logo2-url>",
          "summary": "Test"
        }
      },
      "testingInstructions": "test using alexa"
    }
  }
}
2 Answers

Check the encoding of the skill-manifest.json file!

When downloading the file with the ask cli it had UTF-16 LE set in my case, which is not accepted when updating for some reason. After changing the encoding to either UTF-8 or ISO 8859-1 it worked.

I ran into the same issue few months ago while uploading a manifest. The issue was that the json file had to be preceded by the prefix "file:" like:

--manifest "file:manifestFile.json"

And so your command would be:

ask smapi update-skill-manifest -s --manifest "file:skill-manifest.json"

Here are more details about this.

Related