azure function not connecting via DirectLine to bot framework - azure

I am try to setup azure function with HTTP triggered and make subsequent call to azure bot framework [bot service on azure].
Following is the error i encountered while setting it up:
{
"id": "ed81eca8-d536-4534-a97d-66e6a7ca7ad2",
"requestId": "ba346904-702b-465c-b7e3-b48afe29ab33",
"statusCode": 500,
"errorCode": 0,
"messsage": "Exception while executing function: Functions.adapter -> Unable to resolve value for property 'BotAttribute.SecretSetting'."
}
Env:
Nodejs dev
Using directline-JS git repo at BotFramework-DirectLineJS
Related questions:
Azure function doesn't notify my bot (Bot Framework)
Azure Function for Bot Framework C#

The secret was defined but i was returning value in a wrong way in azure function. i.e context.done(done,data) where i was passing incoming data directly to output which did not hold secret, rather than modified version of data.

Related

Logic App http trigger with AAD auth - Event grid subscription validation failure

I'm trying to create an event grid subscription that will call a logic app every time a blob is created.
To protect the logic app http endpoint, I've enabled AAD Auth following this documentation:
Enable Azure AD OAuth for your logic app
I then configured eventgrid to attach an oauth token while calling the logic following this documentation:
Publish events to Azure Active Directory protected endpoints
While creating the subscription, I received this error:
Deployment has failed with the following error:
{
"code": "Url validation",
"message": "Webhook validation handshake failed for https://prod-07.australiaeast.logic.azure.com/workflows/5aade5e78ff84281baf17c0ab70a35d8/triggers/manual/paths/invoke. Http POST request failed with response code Unknown. For troublehooting, visit https://aka.ms/esvalidation. Activity id:4d430ada-82ee-43a6-8ad4-467f6de611d8, timestamp: 7/17/2021 12:44:13 AM (UTC)."
}
Using requestbin, I checked that the oauth token was attached (see associated requestbin)
I've also validate that the token was valid by calling the logic (from postman) using the token from requestbin.
I tired the same using a function app and it worked.
So I decided to try exposing the logic app behind API management service and it worked...
So I'm guessing Azure is doing something special with the internal logic app url: https://prod-07.australiaeast.logic.azure.com/workflows/5aade5e78ff84281baf17c0ab70a35d8/triggers/manual/paths/
Does anyone encounter the same issue and was able to work around that in a better way?

Azure event grid api version undefined

I created an azure event Topic and added an azure function (event trigger type) as a subscription. when trying to send a request through postman I get undefined API version.
Error:
{
"error": {
"code": "ApiVersionUnspecified",
"message": "An API version is required, but was not specified."
}
}
This is the error you get:
As Roman Kiss says, you should use URI like below:
https://<topic-endpoint>?api-version=2018-01-01
(And also you need to authorize it.)
I received this error when I was submitting a GET request instead of a POST request.

azure api management retrieving password from shell script ,saving it and deploying it

I had seen multiple examples how to use Azure API manager using powershell to retreive password for SCM but unable to find any example using it without powershell i.e. something execution in shell command line. i am also looking for example for saving and deploying my api
You can always inspect any Azure service API in action by doing what you need in Azure portal and seeing what requests get sent. Correlating them with documentation helps. So to get access token for SCM endpoint in APIM you need:
With any Azure credentials make a GET call to https://management.azure.com/subscriptions/.../resourceGroups/.../providers/Microsoft.ApiManagement/service/.../tenant/access/git?api-version=2018-01-01
in response you will get a payload similar to:
{
"id": "XXX",
...
}
Take "id" from that payload and make a POST call to https://management.azure.com/subscriptions/.../resourceGroups/.../providers/Microsoft.ApiManagement/service/.../users/XXX/token?api-version=2018-01-01
you will get your token:
{
"value":"..."
}

Microsoft bot on AWS Lambda (botbuilder-aws-lambda) errors

I have a developed a Microsoft bot that works using the botframework emulator, I want to host it on AWS Lambda, and am using the following code and when I execute it on lambda, it results in errors.
const builder = require('botbuilder');
const lambda = require('botbuilder-aws-lambda');
var connector = new builder.ChatConnector({
appId: 'My App ID',
appPassword: 'PassWord ID'
});
exports.handler = lambda(connector);
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});
The following are the errors:
"errorMessage": "RequestId: 2d91dffa-84d3-11e7-870e-0151204c40e6 Process exited before completing request"
The detailed log file shows the following:
2017-08-19T11:40:20.889Z 2d91dffa-84d3-11e7-870e-0151204c40e6 SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at handler (/var/task/node_modules/botbuilder-aws-lambda/lib/index.js:5:24)
"errorMessage": "RequestId: 2d91dffa-84d3-11e7-870e-0151204c40e6 Process exited before completing request"
I'm not sure what your issue is, but I thought I would share some of my learning working with Twilio and AWS Lambda. Not sure if this is what you already know or not however:
API Gateway - in order to expose an HTTP endpoint via a Lambda, you require a API Gateway configured to point to the AWS Lambda.
Lambda Request - the only payload that Lambda will receive is a JSON payload. Twilio will only produce a FORM-URL-Encoded format. You have to configure API Gateway to transform the Form-URL-Endcoded to JSON.
Lambda Reply - JSON in, JSON out. To convert the reply from JSON to TwiXML, you have to transform the message from JSON to TwilXML
AWS Lambda, IMO, doesn't hold a candle to Azure Functions. Do yourself a favour and try Azure Functions - it does not have any the restrictions of AWS Lambda, and does not have to go through a translation layer like API Gateway. In addition, and likely the best feature, you can run it locally without having to create your own framework. Why AWS would not prioritize a local development environment is beyond me - other than perhaps being first to market.
HTH

Google Cloud Endpoints - Method does not exist - OpenAPI yaml specification

I'm trying to setup a NodeJS REST API using Google Cloud Endpoints and Google App Engine. I've cloned the offical sample project from GitHub and set up Google Cloud Endpoints using the Quickstart. Out of the box, it works fine,but I tried adding another API endpoint for a GET request at /, but the response I get after I deploy and make the request is as follows:
{
"code": 5,
"message": "Method does not exist.",
"details": [
{
"#type": "type.googleapis.com/google.rpc.DebugInfo",
"stackEntries": [],
"detail": "service_control"
}
]
}
The APIs which came pre-configured works fine, but only new ones which I add aren't working.
I've configured the new endpoint properly in my NodeJS app (it works fine locally). The corresponding code I've added is:
app.get('/', function (req, res) {
res.status(200).json({ message: 'Hello, world!' });
});
I've added the following to my openapi.yaml file:
paths:
"/":
get:
description: "Returns the message \"Hello, World\""
operationId: "root"
produces:
- "application/json"
responses:
200:
description: "Hello"
schema:
$ref: "#/definitions/helloMessage"
definitions:
helloMessage:
properties:
message:
type: "string"
After running gcloud service-management deploy openapi.yaml from a terminal to deploy and configure Google Cloud Endpoints, I got the service name and the service configuration ID, which I've replaced in app.yaml, in the format specified by the QuickStart
endpoints_api_service:
name: echo-api.endpoints.[YOUR-PROJECT-ID].cloud.goog
config_id: YOUR-CONFIG-ID
(That's the format, I've replaced YOUR-PROJECT-ID and YOUR-CONFIG-ID with the right ones)
I deployed the app to Google App Engine using gcloud app deploy. I can see the app running properly, via the Google App Engine console.
Yet, the GET method on / is not being identified as a valid endpoint and I get the response as stated above.
Am I missing something? I searched a lot about this problem, but didn't come across anything useful/similar!
P.S: By added, I mean, it is the code which I've added to the corresponding GitHub cloned files
EDIT:
I changed the API endpoint from / to /hello and it works fine!! Unable to understand why the same functionality on / is not working on Google Cloud Endpoints (works locally though!)
Google Cloud Endpoints does not currently support the root path at "/". This is something that is being looked into.

Resources