serverless-google-cloudfunctions
serverless-google-cloudfunctions copied to clipboard
Individual packaging of function does not work for Google Cloud Functions
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
Adding an artifact: xxx to the package level entry removes the error, but sls package results in nothing being generated.
@huysamen did you find a workaround on this one? I'm getting the same error
@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.
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...
any update?
There is this PR https://github.com/serverless/serverless-google-cloudfunctions/pull/164 that @wootencl did a very good job to start it. There is however few things here and there before it can be merged.
Does anyone know how to fix this? I'm getting this error using serverless in a monorepo with yarn. Thanks
I'm curious as well if any more support has been added for this?