2

I am trying to invoke a simple lambda function (the lambda function prints hello world to console) using ruby . However when I run the code and look at the swf dashboard . I see the following error :

Reason: An Activity cannot send a response with data larger than 32768 characters. Please limit the size of the response. You can look at the Activity Worker logs to see the original response.

Could someone help me out to resolve this issue?

the code is as follows:

require 'aws/decider'
require 'aws-sdk'

class U_Act
extend AWS::Flow::Activities
activity :b_u do
    {
        version: "1.0"
    }
end

def b_u(c_id)
    lambda=Aws::Lambda::Client.new(
    region: “xxxxxx”
    access_key_id: “XxXXXXXXXXX”,
    secret_access_key: “XXXXXXXXXX”
        )
        resp = lambda.invoke(
    function_name: “s_u_1” # required
    )
        print "#{resp}"
end

Thanks

Kobi
  • 135,331
  • 41
  • 252
  • 292
Amogh Huilgol
  • 1,252
  • 3
  • 18
  • 25
  • 1
    Try changing ``print "#{resp}"`` to``'test'`` (with the single quotes) and see if it still errors out. – Nabeel Jun 30 '16 at 23:19
  • 1
    Just a note: you don't have to run an activity task that runs a Lambda function: SWF can start a Lambda function directly, using [`ScheduleLambdaFunction`](http://docs.aws.amazon.com/amazonswf/latest/apireference/API_Decision.html) and [`ScheduleLambdaFunctionDecisionAttributes`](http://docs.aws.amazon.com/amazonswf/latest/apireference/API_ScheduleLambdaFunctionDecisionAttributes.html). – Kobi Jul 01 '16 at 05:17
  • A workaround that I would suggest is to call an @Signal method with the response received and populate it in your workflow from which you are calling. – neo7 Jul 14 '16 at 20:42

1 Answers1

0

According to AWS documentation you cannot send input / result data set size larger than 32,000 characters. This limit affects activity or workflow execution result data, input data when scheduling activity tasks or workflow executions, and input sent with a workflow execution signal.

Workaround to resolve this issue are

  1. Use AWS S3 to upload the message and send the path of the S3 message between the activities.
  2. If you need high performance use Elasticache and store the values and pass the keys between the activities.
Nithin
  • 9,661
  • 14
  • 44
  • 67
  • I am not trying to send any data to the lambda function . All I am trying to do is print "hello world" on console using lambda .So the function does not send or receive any data – Amogh Huilgol Sep 16 '16 at 17:10