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

Getting TypeError: Cannot read property 'push' of undefined #34

Open
kamyaarbutt opened this issue May 25, 2021 · 5 comments
Open

Getting TypeError: Cannot read property 'push' of undefined #34

kamyaarbutt opened this issue May 25, 2021 · 5 comments

Comments

@kamyaarbutt
Copy link

kamyaarbutt commented May 25, 2021

When i add

`plugins:

  • serverless-ruby-package
    `

i get TypeError: Cannot read property 'push' of undefined

Type Error ----------------------------------------------

TypeError: Cannot read property 'push' of undefined
at PackageRubyBundlePlugin.beforePackage (/Users/xxxx/node_modules/serverless-ruby-package/index.js:85:45)
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:576:20)
at async PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:634:7)
at async Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:327:5)
at async /usr/local/lib/node_modules/serverless/scripts/serverless.js:704:9

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information ---------------------------
Operating System: darwin
Node Version: 16.2.0
Framework Version: 2.43.0
Plugin Version: 5.1.3
SDK Version: 4.2.2
Components Version: 3.10.0

@apsoto
Copy link

apsoto commented May 26, 2021

If you look at the stack trace on master (assuming it matches what you have installed)

The code is:

this.serverless.service.package.include.push("vendor/bundle/bundler/**");

So that is saying that include is not defined

Do you have

package:
  include:
    - handler.rb

In your serverless.yml?

@qaswm
Copy link

qaswm commented Jun 15, 2021

My other account locked out so writing from here.

We need to package the functions individually so have the 'include' in each function and not in the main. Still getting the issue.

service: myservice
frameworkVersion: '2'

plugins:
  - serverless-ruby-package


custom:
  rubyPackage:
    alwaysCrossCompileExtensions: true


provider:
  name: aws
  runtime: ruby2.7
  lambdaHashingVersion: 20201221
  profile: demofive

package:
  exclude:
    - '**'

functions:
  hello1:
    handler: handler.hello1
    events:
      - http:
          path: hello1
          method: post
    package:
      include:
        - hello1/**

  hello2:
    handler: handler.hello2
    events:
      - http:
          path: hello2
          method: post
    package:
      include:
        - hello2/**
   

@apsoto
Copy link

apsoto commented Jun 15, 2021

try putting a top level package/include for an unimportant file just so something is there.

Also, I've never done this per function include, so that might be another complication.

@qaswm
Copy link

qaswm commented Jun 16, 2021

seems per function include not working.

I added the include in top-level and it worked but now everything is going in every lambda. How to only package only the required items in each lambda.

@joshuaflanagan
Copy link
Owner

I added the include in top-level and it worked but now everything is going in every lambda. How to only package only the required items in each lambda.

I don't think this feature is currently supported. I will try and look into it this weekend, but can't make a guarantee. I'd welcome any contribution if someone wants to make an attempt.

svestu added a commit to svestu/serverless-ruby-package that referenced this issue Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants