Legacy Dev Forum Posts

 View Only

Sign Up

clientContext unavailable in Lambda data action

  • 1.  clientContext unavailable in Lambda data action

    Posted 06-05-2025 18:41

    TheRealKevinGlinski | 2020-05-01 12:35:23 UTC | #1

    For a Lambda Data Action, I do not see the headers in the clientContext object like the docs say should be there https://help.mypurecloud.com/articles/add-configuration-custom-actions-integrations/. I have attempted this in Go and in python 3 and the headers are nowhere to be found. Are the headers getting added to the 'custom" field of the clientContext object or are they being added somewhere else? The docs don't really specify the exact location. I am running a Test of the Data Action and not an actual execute, but that shouldn't matter should it?

    For Python the clientContext looks like this ClientContext: { "py/object": "bootstrap.ClientContext", "custom": null, "env": null, "client": null }

    and for Go the clientContext looks like this: ClientContext:{Client:{InstallationID: AppTitle: AppVersionCode: AppPackageName:} Env:map[] Custom:map[]}}

    Python lambda code:

    import jsonpickle
    
    def lambda_handler(event, context):
        print("Context: {}".format(vars(context)))
        print("ClientContext: {}".format(jsonpickle.encode(context.client_context)))

    Jason_Mathison | 2020-05-01 15:20:36 UTC | #2

    Hey Kevin,

    The author of this code is out today. Looking at the code all of the headers are expected to be Key/Value pairs on the root of the Client Context. I don't see any reason that running this in test mode would impact this. Next up is checking on our testing around this feature.

    --Jason


    TheRealKevinGlinski | 2020-05-01 20:12:22 UTC | #3

    thank you Jason


    Jason_Mathison | 2020-05-04 12:32:02 UTC | #4

    So it looks like the way we implemented this works for Node.js Lambdas, but fails for some, if not all, other Lambda language options. Here is an example of someone hitting this same issue with python https://github.com/aws/aws-sdk-js/issues/1388

    We are testing out some ideas for how to get this to work for Python etc without breaking any existing Node.JS lambdas.


    Jason_Mathison | 2020-05-18 17:45:38 UTC | #5

    We have a fix for this in testing, and baring any issues it should be released in the next day or two.


    anon47876146 | 2020-05-19 13:38:47 UTC | #6

    Kevin, This should be fixed now. Sorry about that!


    system | 2020-06-19 13:38:47 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 7695