AWS Appsync API and Lambda



  • Hello Everyone-

    I am used to using the AWS amplify framework which is drop dead easy to set up but not applicable for this current use case. Would someone have good reference or code/toy example to connect an Aws Appsync API to a Lambda triggering report creation and email?

    In the last few days, and brand new to JSReport, I've been able to follow along and get the serverless version working and emails sent when using test.js. I am trying to move to a more production-like app.

    Now I want to put an API in front of the Lambda and pass variables. Googling and Github didn't seem to surface much.

    Thanks in advance!



  • If I understand correctly, I need to put an API in front of the lambda, make sure it is secured, and then pass it the minimum payloads of {

    "resource": "/report",
    "path": "/",
    "httpMethod": "POST",
    "template": {
    "name": "testreport"
    }
    }

    Is that roughly correct?



  • I think you can have better luck on StackOverflow or a forum dedicated to aws amplify framework.
    Our AWS serverless demo works the way that lambda call sends rendering request json and receives back json with base64 encoded report content.
    This should be universal enough to integrate everywhere.
    I am sorry for not providing a better answer. I didn't try the AWS Appsync yet.



  • No problem at all. Thank you for your cordial response and extraordinary platform. I will keep collecting more info on it. All the best.



  • For what it is worth, if anyone is looking to test from the CLI, after setting up the lambda and layer on serverless, create a properly formatted .json file with the following payload and then use the command below.

    {
    "renderRequest": {
    "template": {
    "name": "template-name-here"
    }
    }
    }

    aws lambda invoke --function-name foo-report --payload file://foopayload.json foo-out.txt

    Please note the function name, the payload (in json file format) and the text file are all required.

    Next up, fronting a secure API...


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.