Jovo v4 Azure Functions

v4

#1

Hi,

We want to deploy handlers into Azure Cloud Functions. I don’t see any readily available integration for Azure. I’m trying to deploy using serverless. But app.prod.ts is returning export * from './server.lambda'; which is AWS Lambda specific.

server.lambda.ts:

import { APIGatewayEvent, Callback, Context, Lambda } from '@jovotech/server-lambda';

export const handler = async (event: APIGatewayEvent, context: Context, callback: Callback) => {
  await app.initialize();
  await app.handle(new Lambda(event, context, callback));
                       ^^^^^^
};

Is there any generic handler function which I can use for Azure Functions also? Thanks


#2

In future, we also want to support Google Cloud as well. So, code should be cloud-agnostic as much as possible. Any suggestions on this? Thanks


#3

Currently, we don’t have implementations for Azure Functions or Google Cloud.

However, it should work with both platforms. Not 100% sure, but I don’t think generic handlers would work. You just need to implement the abstract methods of the Server class.

Here’s the example for Lambda for v4: https://github.com/jovotech/jovo-framework/blob/v4/latest/integrations/server-lambda/src/Lambda.ts

Here are examples of Azure Functions and Google Cloud functions v3 implementations. Not fully compatibly, but you get the idea.



#4

Thanks for the pointers @AlexSwe . I’ll try to implement Azure part first.


#5

I’m almost done with Azure Server implementation. But as suggested by Azure Functions docs and Jovo v3 Azure implementation, I couldn’t find a suitable Logger method for adding an appender (https://github.com/jovotech/jovo-framework/blob/v3/dev/jovo-framework/src/hosts/AzureFunction.ts#L15)

From’logleverl doc,

it does not let you reconfigure appenders

Any other way to add appender or delegate the Jovo logs to Azure context.log.xxx?