# Getting "Process exited before completing request" Error message when running AWS Lambda with Serverless \[GoLang\]

**URL:** <https://forum.serverless.com/t/getting-process-exited-before-completing-request-error-message-when-running-aws-lambda-with-serverless-golang/8737>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, api-gateway\
**Created:** [July 9, 2019, 2:34pm UTC](https://forum.serverless.com/t/getting-process-exited-before-completing-request-error-message-when-running-aws-lambda-with-serverless-golang/8737 "2019-07-09T14:34:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan995](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@Stefan995](https://forum.serverless.com/u/Stefan995)\
**Post date:** [July 9, 2019, 2:34pm UTC](https://forum.serverless.com/t/getting-process-exited-before-completing-request-error-message-when-running-aws-lambda-with-serverless-golang/8737/1 "2019-07-09T14:34:32Z")

</div>

Hello everyone! I am new to this forum and to serverless programming as well. I have a GoLang application which consists of many Lambda functions. Currently, I am trying to run a specific function by

1. Deploying it to specified cloud storage
2. Running: serverless invoke -f function-name -l

Here is my serverless.yml file:

```
service: LambdaConfigService

provider:
  name: aws
  runtime: go1.x
  stage: test
  region: us-east-1
  versionFunctions: false
  environment:
    STAGE: ${self:provider.stage}
    MAX_FRAME_NUM_TO_PROCESS: "3000"
    MAX_URL_VALID_DURATION: "300"
    S3_REGION: ${self:provider.region}
  iamRoleStatements:
    - Effect: Allow
      Action: "s3:*"
      Resource: "*"

functions:
  Thumbnail:
    handler: bin/thumbnail
    description: Used in order to generate thumnails given a time range and a source id
    timeout: 300
    memorySize: 3008
    events:
       - http:
          path: ai/thumbnail
          method: post
          cors: true
    layers:
      - {Ref: FfmpegLambdaLayer}

layers:
  ffmpeg:
    path: ffmpegLayer

```

And here is how I’ve organized my function code, specifically, its Handler function:

```
func main() {

glog.Info("Starting Thumbnail Lambda ...")

lambda.StartHandler(lambda.NewHandler(Handler{}))

}

type Handler struct{}

func (handler Handler) Invoke(ctx context.Context, payload []byte) ([]byte, error) {
	glog.Info("Thumbnail Lambda Handler function has been Invoked ...")

	lambdaConfig := config.Config{}
	thumbnailLambdaStatus := status.Initialize()

	apiGatewayEvent := new(events.APIGatewayProxyRequest)
	if err := json.Unmarshal(payload, apiGatewayEvent); err != nil {
		glog.Errorf("Error occurred while trying to unmarshal payload as APIGatewayProxyRequest. Error message - %v", err)
		return nil, err
	} else {
		if err := json.Unmarshal([]byte(apiGatewayEvent.Body), &lambdaConfig); err != nil {
			glog.Errorf("Error occurred while trying to unmarshal body of APIGatewayProxyRequest. Error message - %v", err)
			return nil, err
		}

		err := lambdaConfig.Validate()
		if err != nil {
			glog.Errorf("Error during validation of Config struct. Error message - %v", err)
			return nil, err
		}

		switch strings.ToUpper(apiGatewayEvent.HTTPMethod) {
		case "POST":
			resp, err := thumbnailLambda(&lambdaConfig, &thumbnailLambdaStatus)
			if err != nil {
				glog.Errorf("Error occurred while trying to execute Thumbnail Lambda's core logic. Error message - %v", err)
				return nil, err
			}

			glog.Infof("Response: %s", resp.Body)
			break
		default:
			err = fmt.Errorf("Invalid method: %s", apiGatewayEvent.HTTPMethod)
		}

	}

	return nil, nil
}

```

I do realize that this cannot work since I am not sending any input to it. But, to my knowledge, I should at least get some messages that I’ve put in the code printed. For example, shouldnt I get message from `main` function and Handler’s `invoke` function printed?

What could be causing this error? I appreciate any sort of help!
