aws-amplify / amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
https://docs.amplify.aws/
Apache License 2.0
88 stars 76 forks source link

Appsync async lambda invocation funtionality in GEN2 #2610

Open anni1236012 opened 3 months ago

anni1236012 commented 3 months ago

Describe the feature you'd like to request

AWS AppSync now supports long running events with asynchronous Lambda function invocations. it is great to have this feature available in GEN2. Please see the the official announcement. https://aws.amazon.com/about-aws/whats-new/2024/05/aws-appsync-events-asynchronous-lambda-function-invocations/

Describe the solution you'd like

Currently, users could only invoke Lambda functions synchronously from AppSync, which meant that the GraphQL API would wait for the Lambda function to complete before returning a response. With the recent support of event mode in appsync it will be great to have this functionality in GEN2 as well.

Describe alternatives you've considered

We can still invoke the lambda function asynchronously using the lambda invocation type "Event" but need to handle the logic ourself instead of passing the mode event directly from the client side.

Something like this

 await lambda
      .invoke({
        FunctionName: context.functionName,
        InvocationType: "Event",
        Payload: JSON.stringify({
          arguments: {
            content: "submitted async from lambda",
            invokeType: "lambda",
            filePaths: event.arguments.filePaths,
          },
        }),
      })
      .promise();

    return {
      message: "Lambda function submitted"
    };

Additional context

No response

Is this something that you'd be interested in working on?

Would this feature include a breaking change?

AnilMaktala commented 3 months ago

Hey @anni1236012, Thanks for requesting this. We will mark it as a feature request for the team to evaluate further.