OptionalauthThe authorization level for the Azure Functions HTTP trigger.
OptionalcontextContext provider that parses request data and returns context for the flow. This follows the same pattern as express, next.js, and other Genkit integrations.
The context provider receives a RequestData object containing:
Return an ActionContext object that will be available via getContext() in the flow. Throw UserFacingError for authentication/authorization failures.
import { UserFacingError } from 'genkit';
const authProvider: ContextProvider = async (req) => {
const token = req.headers['authorization'];
if (!token) {
throw new UserFacingError('UNAUTHENTICATED', 'Missing auth token');
}
const user = await verifyToken(token);
return { auth: { user } };
};
export const handler = onCallGenkit(
{ contextProvider: authProvider },
myFlow
);
OptionalcorsCORS configuration. Set to false to disable CORS headers.
OptionaldebugWhether to log incoming requests (for debugging).
OptionalhttpHTTP methods to register for the Azure Functions HTTP trigger.
OptionalonCustom error handler for transforming errors before response.
OptionalrouteOptional custom route for the Azure Functions HTTP trigger. If not provided, the function name is used as the route.
OptionalstreamingWhether to return a streaming handler.
When true, the handler returns a streaming response using
ReadableStream for incremental SSE delivery.
The streaming handler is compatible with streamFlow from genkit/beta/client.
For clients sending Accept: text/event-stream, it writes SSE chunks
incrementally. Otherwise it falls back to a buffered JSON response.
Options for configuring the Azure Functions handler