Skip to content

Allow stored procedures in output bindings #605

Open
@NathZ1

Description

@NathZ1

chgagnon edit - Changing the title to reflect the root ask, being able to support stored procedures in output bindings.

Hi team,

I am following the documentation to delete a row of data from Azure SQL database, which requires creation of a stored proc which can be triggered with parameters.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-azure-sql-input?tabs=in-process&pivots=programming-language-javascript#http-trigger-delete-one-or-multiple-rows-javascript

The big issue I have with this is that I want to do checks prior to the stored proc executing, which I have in the index.ts (using JavaScript). I know I can run checks before adding / updating data in a table using something like this that will conditionally update the discharge table if userAuth returns true (see example below), but there doesn't seem to be something similar I can do for Stored Procs - they execute immediately?

import { AzureFunction, Context, HttpRequest } from "@azure/functions"
import { isUserAuth } from "../utilities"

const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
    const userAuth = await isUserAuth(req.headers.token)

    if (userAuth) context.bindings.discharge = req.body

    //return
    context.res = {
        status: userAuth ? 200 : 403,
        mimetype: "application/json",
        body: userAuth ? req.body : undefined
    };
};

export default httpTrigger;

Is this functionality that can be added, or is there a workaround to achieve the desired result?

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions