Cannot read properties of undefined (reading 'pipe')

  • We need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
    rewardiply

I am having a new error when I hit one of my lambda service.

◈ Function Message has returned an error: Cannot read properties of undefined (reading 'pipe')
TypeError: Cannot read properties of undefined (reading 'pipe')
    at runFunctionsProxy (file:///opt/homebrew/lib/node_modules/netlify-cli/src/lib/functions/local-proxy.js:39:25)
    at Module.invokeFunction (file:///opt/homebrew/lib/node_modules/netlify-cli/src/lib/functions/runtimes/go/index.js:43:30)
    at NetlifyFunction.invoke (file:///opt/homebrew/lib/node_modules/netlify-cli/src/lib/functions/netlify-function.js:182:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handler (file:///opt/homebrew/lib/node_modules/netlify-cli/src/lib/functions/server.js:169:39)

Response with status 500 in 197 ms.

The lambda is written in go, and comment out to super duper simple:

package main

import (
//	"bytes"
	"database/sql"
//	"encoding/json"
	"errors"
	"fmt"
//	"image"
//	"io"
	"regexp"
	"time"

//	"github.com/google/uuid"
//	"github.com/grokify/go-awslambda"

	"github.com/aws/aws-lambda-go/events"
	"github.com/aws/aws-lambda-go/lambda"

//	"github.com/shrinerp/hokr/internals/cache"
//	"github.com/shrinerp/hokr/internals/shared"
)

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

	var txn string
	action, ok := request.Headers["view"]

	if !ok {
		fmt.Println("List View from the headers")
	}
	switch action {

	case "saveimage":
	case "savestoreimage":
		txn = "I LOVE CATS"
	case "postsave":
		txn = "MEOW"

	}

	// Your server-side functionality
	return &events.APIGatewayProxyResponse{
		StatusCode: 200,
		Headers:    map[string]string{"Content-Type": "application/json"},
		Body:       txn,
	}, nil
}

func main() {
	// Make the handler available for Remote Procedure Call
	lambda.Start(handler)
}


This was working, and now it is not working, what do I do?

Couple of questions:

  • What version of CLI are you using?
  • Could you try rolling a few versions ahead and behind to see if a specific version caused this?
  • Does this work in production(that is when deployed)?

CLI Version

  System:
    OS: macOS 14.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 203.03 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.5.0 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
  npmPackages:
    netlify-cli: ^17.11.1 => 17.11.1
  npmGlobalPackages:
    netlify-cli: 17.10.1

What version should I roll back to?

Does it work in production? I don’t know. It was all of sudden I have a throttle taking place in production from Cockroach which I am working on resolving with them, and I have this block locally.

Interesting…

Based on the stacktrace, the error is coming from: cli/src/lib/functions/local-proxy.ts at main · netlify/cli (github.com) and in the code, we’re already using optional chaining: ?. before .pipe(). So if proxyProcess.stderr is undefined, pipe() should never be called, and thus, the error doesn’t make sense to me.

This part is interesting though. Do you have 2 installations of the CLI? Maybe this was a bug in the older version which might be fixed in the latest one? Try uninstalling the older version.

I only have this version of the CLI installed, as it is a new, clean build with a fresh ihstall of the CLI

but… the application was created on a different machine, which had a different CLI version.

I will clear the CLI install and reinstall…

I have fully installed netlify-cli and reinstalled it and am still getting the same error.

After some tinkering, there was an error the said E2BIG buried in the error stack, which there was an image upload, so I reduced the size of the upload… Boom, no more error.