Skip to content

Commit 323c51e

Browse files
committed
fix bug when using layer without having deps
1 parent 28238f3 commit 323c51e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@serverless/aws-lambda",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"main": "./serverless.js",
55
"publishConfig": {
66
"access": "public"

serverless.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path')
22
const aws = require('aws-sdk')
33
const { mergeDeepRight, pick } = require('ramda')
4-
const { Component, hashFile } = require('@serverless/components')
4+
const { Component, hashFile, dirExists } = require('@serverless/components')
55
const {
66
createLambda,
77
updateLambda,
@@ -56,7 +56,11 @@ class AwsLambda extends Component {
5656

5757
config.role = config.role || (await awsIamRole(config))
5858

59-
if (config.bucket && config.runtime === 'nodejs8.10') {
59+
if (
60+
config.bucket &&
61+
config.runtime === 'nodejs8.10' &&
62+
(await dirExists(path.join(config.code, 'node_modules')))
63+
) {
6064
const layer = await this.load('@serverless/aws-lambda-layer')
6165

6266
const layerInputs = {

0 commit comments

Comments
 (0)