BadRequestException: Lex is unable to access the Lambda function - node.js

Hi I am working building chatbot using Aws Lex and lambda.
I am using lexmodelbuildingservice.putIntent API to create new Intent. But when i test my Lambda function. I get below error:
BadRequestException: Lex is unable to access the Lambda function arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:chatBotResponse in the context of intent arn:aws:lex:us-east-1:XXXXXXXXXXXX:intent:BenefitsTwotwo:$LATEST. Please check the resource-based policy on the function
I am using below code in my params:
fulfillmentActivity: {
codeHook: {
uri: "arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:chatBotResponse",
messageVersion: "1.0"
},
type: "CodeHook"
}
Can anybody please tell me how to access and enable lambda arn using nodejs.
Thanks!

BadRequestException
Request validation failed, there is no usable message in the context, or the bot build failed, is still in progress, or contains unbuilt changes.
HTTP Status Code: 400
Did your bot completely built? or contains unbuilt changes?

Related

WebHook call failed. Error: DEADLINE_EXCEEDED, State: URL_TIMEOUT, Reason: TIMEOUT_WEB calling from node

I am not sure what mistake I am doing. I have create a ChatBot in google dialog flow and did setup of WebHook in my local. Once I am hitting from dialogbox then reuqest is landing to code and processed successfully but in Dialogflow response I am getting failure due to some TimOut exception, there a way to fix this . I am facing WebHook call failed. Error: DEADLINE_EXCEEDED, State: URL_TIMEOUT, Reason: TIMEOUT_WEB calling from node.
Below is the index.json snippet :
Below is the console log
At the end of the function you need to resolve the promise.
return Promise.resolve();
Additionally, you're probably already handling errors but in a Firebase Function, if you need to throw an error, you can do that simply this way:
throw new functions.https.HttpsError(
'internal',
'Woops, that should not happen.',
);

554, b'Transaction failed: Nested group in sending email using Amazon Aws SES

I want to send email from my Ubuntu server thru Amazon AWS SES. I've a working code and it's able to send an email.
However when I wrap the working code within a function it's giving this error:
Something with SMTP went wrong...
(554, b'Transaction failed: Nested group')
I'm attaching visual code comparison, .. I'm curious as to what could be wrong.

Dialogflow Webhook call failed. Error: [ResourceName error] Path '' does not match template

I am using Dialogflow ES and once I got the webhook setup, I haven't been having issues. But after a few months, I just started getting a random error. It seems to be inconsistent as in sometimes I get it for a specific web call and other times it works fine. This is from the Raw API response:
"webhookStatus": {
"code": 3,
"message": "Webhook call failed. Error: [ResourceName error] Path '' does not match template 'projects/{project_id=*}/locations/{location_id=*}/agent/environments/{environment_id=*}/users/{user_id=*}/sessions/{session_id=*}/contexts/{context_id=*}'.."
}
The webhook is in GCP Functions in the same project. I have a simple "ping" function in the same agent that calls the webhook. That works properly and pings the function, records some notes in the function log (so I know the function is being called), and returns a response fine, so I know the webhook is connected and working for other intents in the same agent before and after I get the error above.
Other intents in the same agent work (and this one WAS working), but I get this error now. I also tried recreating the intent and I get the same behavior.
The project is linked to a billing account and I have been getting charged for it, so I don't think it is an issue with being on a trial or otherwise. Though the Dialogflow itself is in "trial", but the linked webhook function is billed.
Where can I find what this error means or where to look to resolve it?
After looking at this with fresh eyes, I found out what was happening.
The issue was a mal-formed output context. I was returning the bad output context sometimes (which explained why sometimes it worked and sometimes it didn't). Specifically, I was returning the parameters directly into the output context without the output context 'name' or 'parameters'. Everything looked like it was working and I didn't get any other errors, but apparently, when Dialogflow receives a bad web response, it generates the unhelpful error above.

Issue with SNS unsubscribe using CLI

I have written a code which generates below AWS CLI command to unsubscribe my lambda from certain SNS. Somehow after executing that command do not give any exception but it is not even un-subscribing the SNS as well. Any suggestions here?
aws sns --region 'us-east-1' unsubscribe --subscription-arn "arn:aws:sns:us-east-1:XXXXXX:topicName-f0c5-4e6a-867f-308c2286ef97" --generate-cli-skeleton --profile 'AWSProfile'
This might sound silly but I am not able to figure it out. Thanks in advance guys..!!
The --generate-cli-skeleton option is documented as:
Prints a JSON skeleton to standard output without sending an API request.
Therefore, this is preventing the API request from being sent.
Solution: Remove --generate-cli-skeleton from your request

NodeJS Azure Functions used as a Messenger Bot return an mscorlib error

I'm trying to use Azure Functions as a Messenger bot server using a Generic Webhook. The problem I'm running into is that even running this simple code (most of it is commented out to try & figure out the issue) results in an error (below the code):
module.exports = function (context, data) {
context.log('Webhook was triggered!');
context.res = {
status: 403,
body: ''
}
context.done();
}
Function completed (Failure,
Id=fb0f2178-8b98-4163-a5ae-7ab68eff47cd)
Exception while executing function: Functions.StriverMessenger.
mscorlib: The given key was not present in the dictionary.
Why is this error occurring and how do I get this to work? If I fake out the querystring entries in the run mode inside Azure, the function appears to work as coded. The error occurs when trying to send a Verify request to the Azure Function from Facebook Developer, specifically in Messenger's Webhook setup.
This happens when an empty (or non-json) body is sent to a Function with type WebHook. The handling is poor, and we are improving it per https://github.com/Azure/azure-webjobs-sdk-script/issues/849. This should be deployed within a week and you can then verify.

Resources