Custom wrapper connection to AWS Lambda



  • Kate Larson Senior UX Researcher Community moderator

    David Bobek - Thanks for posting to the Community in case others can offer advice. I see you are also working with our Support team, which is great. I just wanted to let you know the Documentation team will also follow that Support ticket and enhance the documentation per any specific recommendations that result. 

  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    In case it helps, we have a Node.js open source framework that you can use for implementing Lambda extensions.  For imports specifically, it should be as simple as implementing this function signature.

    Please note that you are given an array of records in the postMapData variable, and then you need to return an array of the same length with the results of the import.  i.e. if you are given 2 records in the postMapData variable, then you should return the following to tell that both records were imported correctly. 

    return callback(null, [ {statusCode: 200}, {statusCode: 200} ])

    I highly recommend reading both of these README files. 


    The above frameworks use Node.js, but if you are using a different programming language, then the above frameworks could still be helpful to reverse engineer the HTTP request and response structures used.  Ultimately, these are just HTTP calls, and any programming language that can implement the same request and response structures should work.

  • Simon Camilleri

    Signing the requests canonically would definitely work, but you could also simply place api gateway infront of the lambda, attach an authoriser and make a very nice and plain http request with your auth token.

  • David Bobek

    Hello Scott,

    Thanks for reply, we actually read those samples that you are providing, also as one additional directly SQS wrapper:


    what we are able to do is really process the data as we intend, however defining the response is bit tricky, we are using the exact number of the objects in array, however still getting mismatch, even when in integrator we do not include any hooks or something like that.

    please see the sample of the code:

    exports.handler = async (event) => {
        // TODO implement"Event\n" + JSON.stringify(event.body, null, 2))
            var data =[0].data
        //var data ="request Count\n" + data.length)
        var resp = []
        for (var i=0;i<data.length;i++){
            //"EventS\n" + JSON.stringify(data[i], null, 2))
                statusCode: 200,
                ignored: false,
        }"Response Count\n" + resp.length)
        const response = {
            statusCode: 200,
            body: {}

        return resp;
        //return response;


    From the logs we are tracking the number of results in array:

    2022-02-09T10:21:51.296+01:00 2022-02-09T09:21:51.217Z 2c6ee7a3-b8d7-4b0e-8005-5004636b06c6 INFO request Count 3665

    2022-02-09T09:21:51.237Z 2c6ee7a3-b8d7-4b0e-8005-5004636b06c6 INFO Response Count 3665

    as you can see we are sending an array of exactly the same number of objects as it is in request. and we tried multiple representations.


    All the time getting back as: 

    Extension result doesn't contain the same number of elements as the request object.

    So we are sending what you are actually advising, but not getting success.

  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    Curious if support was able to help you solve the issue?  It is difficult to say what went wrong from your code. 

    For example, I see the following lines of code, but I am not sure how these relate to the array 'postMapData' that contains the exact records sent to your wrapper from  Your code needs to return postMapData.length, but again, not sure what is in[0].data or

    var data =[0].data

    //var data =


Please sign in to leave a comment.