Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

TypeError: Cannot read properties of undefined (reading 'pipes') #80

Open
andreyvital opened this issue Nov 27, 2021 · 3 comments
Open

Comments

@andreyvital
Copy link

Hey—I'm getting the following error:

  TypeError: Cannot read properties of undefined (reading 'pipes')
      at ReadStream.Readable.pipe (node:internal/streams/readable:658:13)
      at Readable.<anonymous> (/Users/(...)/Projects/(...)/api/node_modules/lazystream/lib/lazystream.js:33:12)
      at Readable.instance.<computed> (/Users/(...)/Projects/(...)/api/node_modules/lazystream/lib/lazystream.js:18:14)
      at Readable.read (/Users/(...)/Projects/(...)/api/node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js:443:10)
      at resume_ (/Users/(...)/Projects/(...)/api/node_modules/lazystream/node_modules/readable-stream/lib/_stream_readable.js:790:12)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)
      at runNextTicks (node:internal/process/task_queues:65:3)
      at processImmediate (node:internal/timers:437:9)

I've tried debugging what's the root cause, but no luck.

Versions:

api % cat node_modules/serverless-layers/node_modules/archiver/package.json |jq .version
"3.1.1"
api % cat node_modules/serverless-layers/package.json |jq .version
"2.5.1"
api % cat node_modules/serverless/package.json |jq .version
"2.67.0"

Settings (serverless.yml):

serverless-layers:
  packageManager: npm
  compileDir: .serverless
  forceInstall: ${env:SERVERLESS_LAYERS_FORCE_INSTALL, false}
  dependenciesPath: package.json
  compatibleRuntimes: ["nodejs"]
  layersDeploymentBucket: (...)
  # Why ../../..? Because the script runs on `.serverless/layers/nodejs`
  customInstallationCommand: "../../../scripts/build/install-node-modules.sh"

install-node-modules.sh

echo "Installing dependencies: $(pwd)"
npm install --loglevel=error --no-optional --only=production --audit=false
npm prune --production --audit=false

echo "Running https://github.com/tj/node-prune"
node-prune --exclude "*.d.ts" ./node_modules
@la-jamesh
Copy link

la-jamesh commented Dec 21, 2022

Any luck on this?

@chuankaiwei
Copy link

chuankaiwei commented Jan 5, 2023

same issue. Any luck on this?

--- updates

In my case, It was the serverless-s3-sync issue. When I remove it, everything is OK.

@greenlife-developer
Copy link

Same Issue, has anyone solved it,

Mine worked in development, but gave the issue on production

2023-06-17T10:16:06.144530+00:00 app[web.1]: await stream.pipe(fs.createWriteStream(${req.body.phone}.pdf));
2023-06-17T10:16:06.144530+00:00 app[web.1]: ^
2023-06-17T10:16:06.144530+00:00 app[web.1]:
2023-06-17T10:16:06.144531+00:00 app[web.1]: TypeError: Cannot read properties of undefined (reading 'pipe')

That is on heroku log

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants