Missing Excludes/Includes throws error
dapriett opened this issue · 11 comments
I'm receiving the following error with version 1.2.1
:
Serverless: Bundling with webpack...
Type Error ---------------------------------------------
Cannot read property 'fantasy-land/map' of undefined
I was able to track it to here: https://github.com/goldwasserexchange/serverless-plugin-webpack/blob/master/src/lib/service.js#L5
I have no include or exclude defined in my package settings, which I believe is causing the errors. I reverted by to version 1.2.0
, and everything works fine now.
HI @dapriett,
Thanks for reporting.
Currently investigating this issue. Are you sure you're not getting Cannot convert undefined or null to object
?
Still getting the issue with 1.2.2
- here's the stacktrace:
TypeError: Cannot read property 'fantasy-land/map' of undefined
at module.exports (D:\project\node_modules\ramda\src\internal\_dispatchable.js:29:23)
at D:\project\node_modules\ramda\src\internal\_curry2.js:20:46
at f1 (D:\project\node_modules\ramda\src\internal\_curry1.js:17:17)
at D:\project\node_modules\ramda\src\over.js:37:47
at D:\project\node_modules\ramda\src\lens.js:35:9
at over (D:\project\node_modules\ramda\src\over.js:37:56)
at D:\project\node_modules\ramda\src\internal\_curry3.js:26:46
at f1 (D:\project\node_modules\ramda\src\internal\_curry1.js:17:17)
at when (D:\project\node_modules\ramda\src\when.js:33:20)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_curry3.js:26:46)
at Object.f1 (D:\project\node_modules\ramda\src\internal\_curry1.js:17:17)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_pipe.js:3:27)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_arity.js:5:45)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_pipe.js:3:14)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_pipe.js:3:27)
at Object.<anonymous> (D:\project\node_modules\ramda\src\internal\_pipe.js:3:27)
at Object.setPackage (D:\project\node_modules\ramda\src\internal\_arity.js:5:45)
at ServerlessPluginWebpack.webpackBundle (D:\project\node_modules\serverless-plugin-webpack\src\index.js:51:47)
at Object.before:package:createDeploymentArtifacts [as hook] (D:\project\node_modules\serverless-plugin-webpack\src\index.js:24:62)
at BbPromise.reduce (D:\project\node_modules\serverless\lib\classes\PluginManager.js:234:55)
at tryCatcher (D:\project\node_modules\serverless\node_modules\bluebird\js\release\util.js:16:23)
at Object.gotValue (D:\project\node_modules\serverless\node_modules\bluebird\js\release\reduce.js:157:18)
And the value of my this.serverless.service.package
:
{
artifact: undefined,
exclude: undefined,
include: undefined,
individually: true,
path: undefined
}
Can you share your serverless.yml
?
Looks like R.has('include') and R.has('exclude') returns true if undefined
Hmm...
I actually have a package, this is in my serverless.yml:
package:
individually: true
Looks like serverless converts that to
{
artifact: undefined,
exclude: undefined,
include: undefined,
individually: true,
path: undefined
}
I'm guessing this would break your test:
expect(service.setPackage({exclude: undefined})).toEqual(expectedPackage);
Can you confirm that removing the package
section from your serverless.yml
fixes the error?
Yes, looks like that works - this.serverless.service.package = {}
in that case
This may be where the undefined are coming from: https://github.com/serverless/serverless/blob/c67d60f5d67dd0073dcdafb07392ae5d186841f1/lib/classes/Service.js#L123