Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless + NodeJS v8.0 = error on sls deploy #3723

Closed
Tazer opened this issue Jun 1, 2017 · 15 comments
Closed

Serverless + NodeJS v8.0 = error on sls deploy #3723

Tazer opened this issue Jun 1, 2017 · 15 comments

Comments

@Tazer
Copy link

Tazer commented Jun 1, 2017

This is a Bug Report

Description

For bug reports:

  • What went wrong?
    when running sls deploywhen you have nodejs v8.0
    you will get an error on package. You can see the error below.
  • What did you expect should have happened?
    The deploy successfully completed
  • What was the config you used?
    I used the sample nodejs project.
# Welcome to Serverless!
#
# This file is the main config file for your service.
# It's very minimal at this point and uses default values.
# You can always add more config options for more control.
# We've included some commented out config examples here.
# Just uncomment any of them to get that config option.
#
# For full config options, check the docs:
#    docs.serverless.com
#
# Happy Coding!

service: testing

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"

provider:
  name: aws
  runtime: nodejs6.10

# you can overwrite defaults here
#  stage: dev
#  region: us-east-1

# you can add statements to the Lambda function's IAM Role here
#  iamRoleStatements:
#    - Effect: "Allow"
#      Action:
#        - "s3:ListBucket"
#      Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ]  }
#    - Effect: "Allow"
#      Action:
#        - "s3:PutObject"
#      Resource:
#        Fn::Join:
#          - ""
#          - - "arn:aws:s3:::"
#            - "Ref" : "ServerlessDeploymentBucket"
#            - "/*"

# you can define service wide environment variables here
#  environment:
#    variable1: value1

# you can add packaging information here
#package:
#  include:
#    - include-me.js
#    - include-me-dir/**
#  exclude:
#    - exclude-me.js
#    - exclude-me-dir/**

functions:
  hello:
    handler: handler.hello

#    The following are a few example events you can configure
#    NOTE: Please make sure to change your handler code to work with those events
#    Check the event documentation for details
#    events:
#      - http:
#          path: users/create
#          method: get
#      - s3: ${env:BUCKET}
#      - schedule: rate(10 minutes)
#      - sns: greeter-topic
#      - stream: arn:aws:dynamodb:region:XXXXXX:table/foo/stream/1970-01-01T00:00:00.000
#      - alexaSkill
#      - iot:
#          sql: "SELECT * FROM 'some_topic'"
#      - cloudwatchEvent:
#          event:
#            source:
#              - "aws.ec2"
#            detail-type:
#              - "EC2 Instance State-change Notification"
#            detail:
#              state:
#                - pending
#      - cloudwatchLog: '/aws/lambda/hello'

#    Define function environment variables here
#    environment:
#      variable2: value2

# you can add CloudFormation resource templates here
#resources:
#  Resources:
#    NewResource:
#      Type: AWS::S3::Bucket
#      Properties:
#        BucketName: my-new-bucket
#  Outputs:
#     NewOutput:
#       Description: "Description for the output"
#       Value: "Some output value"
  • What stacktrace or error message from your provider did you see?
_stream_readable.js:545
  switch (state.pipesCount) {
               ^

TypeError: Cannot read property 'pipesCount' of undefined
    at module.exports.Readable.pipe (_stream_readable.js:545:16)
    at module.exports.ZipArchiveOutputStream._smartStream (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/zip/zip
-archive-output-stream.js:184:11)
    at module.exports.ZipArchiveOutputStream._appendBuffer (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/zip/zi
p-archive-output-stream.js:82:10)
    at module.exports.ArchiveOutputStream.entry (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/archive-output-st
ream.js:86:10)
    at module.exports.ZipStream.entry (/usr/local/lib/node_modules/serverless/node_modules/zip-stream/index.js:138:49)
    at Zip.append (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/plugins/zip.js:53:15)
    at Archiver._moduleAppend (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/core.js:172:16)
    at Archiver._onQueueTask (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/core.js:370:8)
    at /usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:4045:9
    at process (/usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:2316:17)
    at Immediate._onImmediate (/usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:66:16)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)

Additional Data

  • Serverless Framework Version you're using:
    1.14.0
  • Operating System:
    Mac OS X
  • Stack Trace:
_stream_readable.js:545
  switch (state.pipesCount) {
               ^

TypeError: Cannot read property 'pipesCount' of undefined
    at module.exports.Readable.pipe (_stream_readable.js:545:16)
    at module.exports.ZipArchiveOutputStream._smartStream (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/zip/zip
-archive-output-stream.js:184:11)
    at module.exports.ZipArchiveOutputStream._appendBuffer (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/zip/zi
p-archive-output-stream.js:82:10)
    at module.exports.ArchiveOutputStream.entry (/usr/local/lib/node_modules/serverless/node_modules/compress-commons/lib/archivers/archive-output-st
ream.js:86:10)
    at module.exports.ZipStream.entry (/usr/local/lib/node_modules/serverless/node_modules/zip-stream/index.js:138:49)
    at Zip.append (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/plugins/zip.js:53:15)
    at Archiver._moduleAppend (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/core.js:172:16)
    at Archiver._onQueueTask (/usr/local/lib/node_modules/serverless/node_modules/archiver/lib/core.js:370:8)
    at /usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:4045:9
    at process (/usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:2316:17)
    at Immediate._onImmediate (/usr/local/lib/node_modules/serverless/node_modules/archiver/node_modules/async/dist/async.js:66:16)
    at runCallback (timers.js:800:20)
    at tryOnImmediate (timers.js:762:5)
    at processImmediate [as _immediateCallback] (timers.js:733:5)
  • Provider Error messages:
    TypeError: Cannot read property 'pipesCount' of undefined
@pmuens
Copy link
Contributor

pmuens commented Jun 2, 2017

Thanks for reporting @Tazer 👍

Seems like the node-archiver package has some problems with the changes in Node v8 (see: archiverjs/node-archiver#236).

We should update this dependency as soon as an update is available.

@audstanley
Copy link

audstanley commented Jun 6, 2017

Same here, looks like i'll need to roll back to 6.10.3 for now. I need to get bash on ubuntu on windows 👍 installed so i can just nvm between projects . Love serverless, keep up the good work. :-)

Update: rollback to 6.10.3 works

@pmuens pmuens modified the milestones: 1.16, 1.15 Jun 6, 2017
@juliensimon
Copy link

Same problem. Quick fix for Mac users using Homebrew:

brew install node@6
brew unlink node
brew link node@6 --force

@damonmaria
Copy link

Or, for homebrew, if you had a version 7 installed:

  1. brew list --versions node
  2. From the list pick a version you want to go back to, e.g. 7.9.0
  3. brew switch node 7.9.0
  4. To stop it being upgraded: brew pin node

@dydx
Copy link

dydx commented Jun 7, 2017

or using nvm: nvm install v7.9.0 && nvm alias default v7.9.0

@ryanmurakami
Copy link
Contributor

ryanmurakami commented Jun 10, 2017

Looks like this was fixed with v8.1.0. I was able to verify it with that version, so this issue can probably be closed now.

@pmuens
Copy link
Contributor

pmuens commented Jun 10, 2017

Thanks for confirming @ryanmurakami 👍

Closing since v8.1.0 seems to fix the issue (as mentioned above).

Feel free to comment if this issue still persists.

@pmuens pmuens closed this as completed Jun 10, 2017
brianz added a commit to verypossible/serverless that referenced this issue Jun 12, 2017
@maludwig
Copy link

Not super familiar with GitHub comments, sorry if this opens this issue again, but here's the suuuper quick fix:
brew upgrade node

@tommedema
Copy link

Which providers support node 8 anyway? Seems like AWS Lambda and GCF don't support it (yet)?

@pmuens
Copy link
Contributor

pmuens commented Sep 11, 2017

Which providers support node 8 anyway? Seems like AWS Lambda and GCF don't support it (yet)?

Yes, that's correct. AWS and GCF use Node 4 / 6:

However I personally always use the latest Node version locally when working on the Framework.

@tommedema
Copy link

@pmuens but then locally a function might work (eg due to using certain es6 features that are not supposed in node 6), while a deployed function would not. Out of curiosity, are you aware of providers that do support node 8?

@pmuens
Copy link
Contributor

pmuens commented Sep 11, 2017

@pmuens but then locally a function might work (eg due to using certain es6 features that are not supposed in node 6), while a deployed function would not. Out of curiosity, are you aware of providers that do support node 8?

Yes, sure. I mean that I use it as my main version when writing code for the Framework. But yes, when writing functions for Lambda or GCF it's always recommended to use the runtime of the FaaS provider!

My assumption would be that they'd add support for it as soon as it gets LTS status (which should be next month --> https://github.com/nodejs/LTS#release-schedule1).

@HyperBrain
Copy link
Contributor

@pmuens As long as they still support the old versions, imo the framework needs to support these too. E.g. we still have some Node 4 projects around, that are tested locally with a Node 4 runtime (serverless invoke local). Until we upgrade them, we'll still have some use cases that use the old version to start the framework.

With an upcoming Node 8 LTS support it would be the same. Only in case the providers remove support for old versions, the support should be dropped from the framework too.

@pmuens
Copy link
Contributor

pmuens commented Sep 11, 2017

@pmuens As long as they still support the old versions, imo the framework needs to support these too. E.g. we still have some Node 4 projects around, that are tested locally with a Node 4 runtime (serverless invoke local). Until we upgrade them, we'll still have some use cases that use the old version to start the framework.

Yes, the goal is to support all the different runtime versions the providers offer 👍

@balaparthacloud
Copy link

balaparthacloud commented Jul 28, 2018

$node -v
v10.7.0

working for me thanks guyz
sorry , V8.0.0 is not working for me as well
if you are okay for your project to update , we can go ahead

How I update node :
followed up
article By PANU PITKAMAKI
section : N
https://bytearcher.com/articles/ways-to-get-the-latest-node.js-version-on-a-mac/

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

No branches or pull requests