Skip to content

Commit eed3382

Browse files
committed
Fallback on using service provider runtime / 'nodejs'
When using "sls deploy function --function=function-name", serverless-webpack would crash if the runtime was not set explicitly for the function. This patch makes behavior consistent with other accesses to the function runtime, falling back on the service provider's runtime (or 'nodejs') if the function doesn't declare a runtime.
1 parent dc4be8a commit eed3382

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class ServerlessWebpack {
106106
'after:package:createDeploymentArtifacts': () => BbPromise.bind(this).then(this.cleanup),
107107

108108
'before:deploy:function:packageFunction': () => {
109-
const runtime = this.serverless.service.getFunction(this.options.function).runtime;
109+
const runtime = this.serverless.service.getFunction(this.options.function).runtime || this.serverless.service.provider.runtime || 'nodejs';
110110

111111
if (isNodeRuntime(runtime)) {
112112
return BbPromise.bind(this)

0 commit comments

Comments
 (0)