Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable (or redirect) logging on an AWS Step Function that calls parallel Lambda functions

I'm running an AWS step function with parallel execution branches.

Each branch succeeds individually, however the overall function fails with the following error:

States.DataLimitExceeded - The state/task returned a result with a size exceeding the maximum number of characters service limit.

I then found an article from AWS that describes this issue and suggests a work around:

https://docs.aws.amazon.com/step-functions/latest/dg/connect-lambda.html

That article says:

The Lambda invoke API includes logs in the response by default. Multiple Lambda invocations in a workflow can trigger States.DataLimitExceeded errors. To avoid this, include "LogType" = "None" as a parameter when you invoke your Lambda functions.

My question is where exactly do I put it? I've tried putting it various places in the state machine definition, however I get the following error:

The field 'LogType' is not supported by Step Functions

That error seems contrary to the support article, so perhaps I'm doing it wrong!

Any advice is appreciated, thanks in advance!

Cheers

UPDATE 1 : To be clear, this is a parallel function, with 26 parallel branches. Each branch has a small output as per the example below. The biggest item in this data is the LogResult, which (when base64 decoded) is just the billing info. I think this info multiplied by 26 has led to the error, so I just want to turn this LogResult off!!!

{
  "ExecutedVersion": "$LATEST",
  "LogResult": "U1RBUlQgUmVxdWVzdElkOiBlODJjZTRkOS0zMjk2LTRlNDctYjcyZC1iYmEwMzI1YmM3MGUgVmVyc2lvbjogJExBVEVTVApFTkQgUmVxdWVzdElkOiBlODJjZTRkOS0zMjk2LTRlNDctYjcyZC1iYmEwMzI1YmM3MGUKUkVQT1JUIFJlcXVlc3RJZDogZTgyY2U0ZDktMzI5Ni00ZTQ3LWI3MmQtYmJhMDMyNWJjNzBlCUR1cmF0aW9uOiA3NzI5Ljc2IG1zCUJpbGxlZCBEdXJhdGlvbjogNzgwMCBtcwlNZW1vcnkgU2l6ZTogMTAyNCBNQglNYXggTWVtb3J5IFVzZWQ6IDEwNCBNQglJbml0IER1cmF0aW9uOiAxMTY0Ljc3IG1zCQo=",
  "Payload": {
    "statusCode": 200,
    "body": {
      "signs": 63,
      "nil": ""
    }
  },
  "SdkHttpMetadata": {
    "HttpHeaders": {
      "Connection": "keep-alive",
      "Content-Length": "53",
      "Content-Type": "application/json",
      "Date": "Thu, 21 Nov 2019 04:00:42 GMT",
      "X-Amz-Executed-Version": "$LATEST",
      "X-Amz-Log-Result": "U1RBUlQgUmVxdWVzdElkOiBlODJjZTRkOS0zMjk2LTRlNDctYjcyZC1iYmEwMzI1YmM3MGUgVmVyc2lvbjogJExBVEVTVApFTkQgUmVxdWVzdElkOiBlODJjZTRkOS0zMjk2LTRlNDctYjcyZC1iYmEwMzI1YmM3MGUKUkVQT1JUIFJlcXVlc3RJZDogZTgyY2U0ZDktMzI5Ni00ZTQ3LWI3MmQtYmJhMDMyNWJjNzBlCUR1cmF0aW9uOiA3NzI5Ljc2IG1zCUJpbGxlZCBEdXJhdGlvbjogNzgwMCBtcwlNZW1vcnkgU2l6ZTogMTAyNCBNQglNYXggTWVtb3J5IFVzZWQ6IDEwNCBNQglJbml0IER1cmF0aW9uOiAxMTY0Ljc3IG1zCQo=",
      "x-amzn-Remapped-Content-Length": "0",
      "x-amzn-RequestId": "e82ce4d9-3296-4e47-b72d-bba0325bc70e",
      "X-Amzn-Trace-Id": "root=1-5dd60be1-47c4669ce54d5208b92b52a4;sampled=0"
    },
    "HttpStatusCode": 200
  },
  "SdkResponseMetadata": {
    "RequestId": "e82ce4d9-3296-4e47-b72d-bba0325bc70e"
  },
  "StatusCode": 200
}
like image 255
Timbo Avatar asked Nov 01 '19 05:11

Timbo


1 Answers

I ran into exactly the same problem as you recently. You haven't said what your lambdas are doing or returning however I found that AWS refers to limits that tasks have within executions https://docs.aws.amazon.com/step-functions/latest/dg/limits.html#service-limits-task-executions.

What I found was that my particular lambda had an extremely long response with 10s of thousands of characters. Amending that so that the response from the lambda was more reasonable got past the error in the step function.

like image 122
Mike Sumner Avatar answered Sep 27 '22 21:09

Mike Sumner