vscode-azurefunctions: Raise binding.context failure information
Environment: macOS VS Code 1.21 latest Azure CLI tools Azure Functions 0.7.0
I’m not sure if this is related to the extension. But I’ve used it to create a function that has an output binding to a CosmosDB document db. I’ve deployed the function to the portal and when I test it from there, passing in a json document, the document does get stored into the db. But when I run it in vscode and then call it from postman and pass in the same doc, the document does not get stored.
I can debug into the function and see the document coming in via req.body.
There are no errors. I have debugged into context when I’m at the closing brace and can’t find any kind of error code. I’ve also tried using application insights and a few other ways to monitor the db to see if there’s any indication of an attempt to create a document but am not seeing anything.
If I could see what is or isn’t happening, then I might be able to fix the problem. Is there something more that the extension could be helping me with?
Here is the function code:
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
try {
context.bindings.outputDocument=req.body;
}
catch(error) {
context.log(error);
}
context.done();
};
Here is the function.json:
{
"disabled": false,
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"type": "documentDB",
"name": "outputDocument",
"databaseName": "Ninjas",
"collectionName": "Ninjas",
"createIfNotExists": true,
"connection": "datapointscosmosdb",
"direction": "out"
}
]
}
localsettings.json:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=functionsample;AccountKey=***",
"datapointscosmosdb": "AccountEndpoint=https://***.documents.azure.com:443/;AccountKey=***"
}
}
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (4 by maintainers)
I don’t think there’s anything we need to do from the extension’s point of view right now.
We will reevaluate after this:
@julielerman @jeffhollan do you agree?
haha look what I found when looking for a solution: https://medium.com/@jeffhollan/serverless-doorbell-ring-com-and-azure-functions-part-2-98bc8fb43e3c 😃