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

Individual packaging of function does not work for Google Cloud Functions #89

Open
huysamen opened this issue Nov 3, 2017 · 8 comments · May be fixed by #164 or #261
Open

Individual packaging of function does not work for Google Cloud Functions #89

huysamen opened this issue Nov 3, 2017 · 8 comments · May be fixed by #164 or #261

Comments

@huysamen
Copy link

huysamen commented Nov 3, 2017

This is a Bug Report

Description

What went wrong?
You get the following error:

Type Error ---------------------------------------------
 
  Cannot read property 'split' of undefined

What did you expect should have happened?
Serverless should compile separate packages for each function.

What was the config you used?

service: my-app

provider:
  name: google
  runtime: nodejs
  project: my-app
  credentials: ~/.gcloud/keyfile.json

plugins:
  - serverless-google-cloudfunctions

package:
  individually: true
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  f1:
    handler: f1
    events:
      - http: f1

  f2:
    handler: f2
    events:
      - http: f2

What stacktrace or error message from your provider did you see?

Serverless: Load command run
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command emit
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command logs
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
 
  Type Error ---------------------------------------------
 
  Cannot read property 'split' of undefined
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
TypeError: Cannot read property 'split' of undefined
    at GooglePackage.compileFunctions (/Users/user/Developer/Development/my-app/node_modules/serverless-google-cloudfunctions/package/lib/compileFunctions.js:13:38)
From previous event:
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:17)
    at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:99:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:86:74)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:39:50)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           6.11.1
     Serverless Version:     1.23.0

Additional Data

Serverless Framework Version you're using: 1.23.0
Operating System: macOS High Sierra 10.13.1

@huysamen
Copy link
Author

huysamen commented Nov 3, 2017

Adding an artifact: xxx to the package level entry removes the error, but sls package results in nothing being generated.

@markmssd
Copy link

@huysamen did you find a workaround on this one? I'm getting the same error

@huysamen
Copy link
Author

@markmssd unfortunately no. We have subsequently switched over to using typescript with our own build process, and stopped using serverless. Webpack 4 does a good job of packaging everything separately without too much configuration.

@markmssd
Copy link

Thanks @huysamen, for typescript I'm using serverless-plugin-typescript, but Webpack's tree shaking is still not working... will probably switch to a custom build process as well...

@wootencl wootencl linked a pull request Apr 18, 2019 that will close this issue
@davestimpert
Copy link

any update?

@markmssd
Copy link

There is this PR #164 that @wootencl did a very good job to start it. There is however few things here and there before it can be merged.

@rafaelrozon
Copy link

Does anyone know how to fix this? I'm getting this error using serverless in a monorepo with yarn.
Thanks

@steinnat
Copy link

I'm curious as well if any more support has been added for this?

@El-Fitz El-Fitz linked a pull request Jun 4, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants