I am deploying a Lex V2 bot with AWS CDK and want my bot to have buttons for eliciting slots, but for some reason I get an error:
DevBot Resource handler returned message:
"Importing CDK-DevBot failed due to [There was an error importing the bot.
Make sure that the imported bot and contents of the zip file are correct, then try your request again.].
The import could not be completed."
(RequestToken: ebd3354f-6169-922a-d0f9-d14690671e25, HandlerErrorCode: InvalidRequest)
This error is not very informative. The relevant part of the CloudFormation template: "Message"
"MessageGroupsList: [{
"Message": {
"ImageResponseCard": {
"Buttons": [
{
"Text": "1.0.3",
"Value": "1.0.3"
},
{
"Text": "1.0.5",
"Value": "1.0.5"
}
],
"Title": "Title"
},
"PlainTextMessage": {
"Value": "Please enter the issue number"
}
}
}]
If I remove "ImageResponseCard" then it deploys okay. Otherwise, I get the error.
Has anybody else had this problem and found a way to overcome it?
The MessageGroupList is an array of Message elements. Every element must have a different type of Message that could be ImageResponseCard or PlainTextMessage. So in your case the template has an incorrect structure, it should be something like that:
{
"MessageGroupsList": [
{
"Message": {
"ImageResponseCard": {
"Buttons": [
{
"Text": "1.0.3",
"Value": "1.0.3"
},
{
"Text": "1.0.5",
"Value": "1.0.5"
}
],
"Title": "Title"
}
}
},
{
"Message": {
"PlainTextMessage": {
"Value": "Please enter the issue number"
}
}
}
]
}
Assumming that the missing tick in MessageGroupList is a typo.
Related
We have had everything working perfectly for the last couple of years, then all of a sudden in the last week we cant log into AWS using the Google SSO.
We are setting up the roles for the users again (as per https://aws.amazon.com/blogs/security/how-to-set-up-federated-single-sign-on-to-aws-using-google-apps/), but when we get to the users.patch (or users.update) section with the following call (values for <role ARN>,<provider ARN> replaced with actual...):
"customSchemas": {
"SSO": {
"role": [
{
"value": "<role ARN>,<provider ARN>",
"customType": "iPDA-sysadmin"
}
]
}
}
}
We get the following error:
{
"error": {
"code": 400,
"message": "Invalid Input: Bad request for ",
"errors": [
{
"message": "Invalid Input: Bad request for ",
"domain": "global",
"reason": "invalid"
}
]
}
}
Any ideas would be great...
https://support.google.com/a/answer/6327792?hl=en
You need to pass in the type as well.
{
"customSchemas":
{
"SSO":
{
"role": [
{
"value": "<role ARN>,<provider ARN>",
"type": "custom"
"customType": "SSO"
}
]
}
}
}
I'm tryng to create a listener rule with two different conditions and i got error all the time.
"ListenerRule": {
"Type": "AWS::ElasticLoadBalancingV2::ListenerRule",
"Properties": {
"Actions": [
{
"Type": "forward",
"TargetGroupArn": {
"Ref": "SwaggBOTG"
}
}
],
"Conditions": [
{
"Field": "query-string",
"QueryStringConfig": {
"Values": [
{
"Key": "app",
"Value": "two"
}
]
},
"Field" : "path-pattern",
"PathPatternConfig": {
"Values" : [ "/one/*" ]
}
}
],
I need two different condition. One of them should be a query-string type and the another one a path-pathern type. I got to create only creating one of them, but i'm not able to create both.
The error is the next:
You cannot specify 'QueryStringConfig' for actions of type 'path-pattern' (Service: AmazonElasticLoadBalancingV2; Status Code: 400; Error Code: ValidationError;
I think that is something of the syntax, but i didn't found the problem..
Thanks in advance.
Problem is that Conditions is a list of separate conditions. You should have 2 separate items in that list in your case. If you take a closer look at your json, you can see that you are defining Field two times at the same level. The second one "Field" : "path-pattern" overrides the first one "Field": "query-string", therefore the error tells you that you can't define 'QueryStringConfig' for "PathPatternConfig" simply because you can't do that.
Here is the correct definition of Conditions.
"Conditions": [
{
"Field": "path-pattern",
"PathPatternConfig": {
"Values": ["/one/*"]
}
},
{
"Field": "query-string",
"QueryStringConfig": {
"Values": [
{
"Value": "two",
"Key": "app"
}
]
}
}
]
I'm triying to multiple language text detection with google cloud vision. But I have a problem.
If I send the request text detection api endpoint this url;
https://vision.googleapis.com/v1/images:annotate?key=XxxXX
and this body;
{
"requests": [
{
"image": {
"source": {
"imageUri": "image_url"
}
},
"features": [
{
"type": "DOCUMENT_TEXT_DETECTION",
"maxResults": 1
}
],
"ImageContext": {
"languageHints": [
"tr", "en"
]
}
}
]
}
I'm getting the this error code;
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"image_context\" at 'requests[0]': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "requests[0]",
"description": "Invalid JSON payload received. Unknown name \"image_context\" at 'requests[0]': Cannot find field."
}
]
}
]
}
}
What is a problem?
The problem is the field "ImageContext", it should be "imageContext" with lower-case "i".
I wanted to know if there were any changes to the dlp api in regards to authentication or whether the service may be down. Seems like the docs don't mention any changes.
The request is formated as such
POST https://dlp.googleapis.com/v2/projects/<project_id>/content:deidentify?key=<key> HTTP/1.1
{
"item": {
"value": "[\"Humphrey\",\"Roy\",\"Hodge\",\"Juarez\",\"Watkins\",\"Calderon\",\"Mayer\",\"Drake\",\"Valdez\",\"Landry\"]"
},
"deidentifyConfig": {
"infoTypeTransformations": {
"transformations": [
{
"primitiveTransformation": {
"replaceWithInfoTypeConfig": {}
}
}
]
}
},
"inspectConfig": {
"infoTypes": [
{
"name": "US_SOCIAL_SECURITY_NUMBER"
},
{
"name": "CREDIT_CARD_NUMBER"
},
{
"name": "US_DRIVERS_LICENSE_NUMBER"
},
{
"name": "EMAIL_ADDRESS"
},
{
"name": "PERSON_NAME"
},
{
"name": "PHONE_NUMBER"
},
{
"name": "LOCATION"
}
]
}
}
The error returned is very cryptic and thus I'm having a hard time figuring out what exactly is going on especially given that the exact same request had been working earlier.
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
There is indeed a bug, the engineering team has a patch for it and is in the process of rolling out the fix. (it only impacts calls unauthenticated, so calling with auth is the work around)
I am having an API in backend to return the full json (schema and options) for a AlpacaJS form. The content-type of the response is application/json. Following is a sample response,
{
"options": {
"fields": {
"students": {
"items": {
"type": "tablerow"
},
"type": "table"
}
},
"form": {
"buttons": {
"submit": {
"click": "function(){alert(\"sample\");}"
}
}
}
},
"schema": {
"properties": {
"students": {
"items": {
"properties": {
"name": {
"required": true,
"title": "Name",
"type": "string"
},
"contact-number": {
"title": "Age",
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
},
"type": "object"
}
}
When I click on the Submit button, I get the following error in browser console,
Uncaught TypeError: t.call is not a function
I think the issue is that the function is considered as a string in the following section of the response.
"form": {
"buttons": {
"submit": {
"click": "function(){alert(\"sample\");}"
}
}
}
Is there a way in AlpacaJS to send a javascript function from backend, or is there a way to convert the function string to a javascript function in frontend?
In order to get that, you should transform the stringified function to a function by doing new Function('return ' + val)(); (beware this is a form of eval and eval is evil).
Here's a working fiddle for that.
Tell me if it didn't work for you.