Support Forums

Invalid AWS Lambda parameters. Reserved keys used in this request


I have a website and am trying to deploy it with a single lambda function that I wrote in Go. When I try running netlify deploy I get the following output:

Deploying to draft URL...
✔ No cached functions were found
✔ Finished hashing 57 files and 1 functions
✔ CDN requesting 32 files and 1 functions
⠏ (32/33) Uploading corsproxy... ›   Warning: JSONHTTPError:  422
 ›   Warning: 
 ›   {
 ›     "name": "JSONHTTPError",
 ›     "status": 422,
 ›     "json": {
 ›       "errors": "Invalid AWS Lambda parameters. Reserved keys used in this request"
 ›     }
 ›   }
⠋ (32/33) Uploading corsproxy...    JSONHTTPError: Unprocessable Entity

The source code for my function:

package main

import (


func handler(request events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) {

	urlString, ok := request.PathParameters["url"]
	if !ok {
		return makeErrorResponse(http.StatusBadRequest, fmt.Errorf("path parameter 'url' is missing"))

	u, err := url.Parse(urlString)
	if err != nil {
		return makeErrorResponse(http.StatusBadRequest, fmt.Errorf("error decoding url: %s", err.Error()))

	req, err := http.NewRequest("GET", u.String(), nil)
	if err != nil {
		return makeErrorResponse(http.StatusInternalServerError, fmt.Errorf("error building request: %s", err.Error()))

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return makeErrorResponse(http.StatusBadGateway, fmt.Errorf("error performing proxy request: %s", err.Error()))

	defer resp.Body.Close()
	data, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return makeErrorResponse(http.StatusBadGateway, fmt.Errorf("error reading proxy response body: %s", err.Error()))

	return &events.APIGatewayProxyResponse{
		StatusCode:        200,
		Headers:           map[string]string{"Content-Type": "text/plain"},
		Body:              string(data),
		IsBase64Encoded:   false,
	}, nil

func makeErrorResponse(statusCode int, err error) (*events.APIGatewayProxyResponse, error) {
	return &events.APIGatewayProxyResponse{
		StatusCode:      statusCode,
		Headers:         map[string]string{"Content-Type": "text/plain"},
		Body:            err.Error(),
		IsBase64Encoded: false,
	}, err

func main() {
	// Make the handler available for Remote Procedure Call by AWS Lambda

I’m just running go build -o dist/corsproxy main.go and I don’t have any environment variables configured in netlify which seems to be what the other people having this error on the forums were running into.

Any guidance is much appreciated.

Hi @lsnow99,

Does this happen only when using Netlify CLI or also using Git-based deploys?

Hi @hrishikesh ,

It only happens when using the Netlify CLI. Git-based deploys work correctly. This is the GitHub Action I am using for my CI builds: https://github.com/nwtgck/actions-netlify (git-based deploys through Netlify aren’t a great fit for what I need to do since I am compiling a web assembly module in Go among other things during the build process). The GitHub Action also fails with the same error as the CLI.

That’s interesting. If this was only local to CLI, we could have escalated this to the CLI devs. But looks like that action is deploying it using Netlify API. I’ll try to gather more info on this.

On a related note, please use the issue you posted in to keep a track of this:

1 Like