dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

Compatible with layers? #48

Open ianbale opened 4 years ago

ianbale commented 4 years ago

Is this plugin compatible with lambda layers?

I'm trying to deploy a package that uses a layer and receiving this error message:

Path must be a string. Received null

Appears to be related to my include of the file in my layer:

const pkg = require('/opt/package1')

ssanri commented 4 years ago

similar issue as above. using layers and excluded in package, plugin still tries to find package in node_modules folder and breaks the deployment.

developer-carsony commented 4 years ago

const lambda_utils = require('/opt/node/lambda_utils.js')

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null         
      at validateString (internal/validators.js:117:11)                 
        at Object.join (path.js:1039:7)
        at handle (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:28:46)
        at /home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:71:9
              at Array.forEach (<anonymous>)                                                                   
        at module.exports (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:64:66)
        at IncludeDependencies.getDependencyList (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:152:12)
        at IncludeDependencies.getDependencies (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:139:31)
        at IncludeDependencies.processNodeFunction (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:112:33)
        at IncludeDependencies.processFunction (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:59:12)
        at /home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:41:14
              at Array.forEach (<anonymous>)                                                                   
        at IncludeDependencies.createDeploymentArtifacts (/home/user/opsste/platform-logging-sls/runway/15-lambda-logging.sls/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:40:3
            8)                                             
              at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:55
                From previous event:                                                                                 
                      at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:22)
        at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:510:17)
        at Deploy.<anonymous> (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:115:50)
    From previous event:
          at Object.before:deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:100:30)
                at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:55
                  From previous event:                 
                        at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:490:22)
        at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:525:24
          From previous event:               
                at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:525:8)
        at /usr/local/lib/node_modules/serverless/lib/Serverless.js:133:33
          From previous event:                                                                                 
                at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:120:74)`
saulomano commented 3 years ago

I have the same issuer with layer TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null at validateString (internal/validators.js:121:11) at Object.join (path.js:1039:7)

saulomano commented 3 years ago

Is this plugin compatible with lambda layers?

I'm trying to deploy a package that uses a layer and receiving this error message:

Path must be a string. Received null

Appears to be related to my include of the file in my layer:

const pkg = require('/opt/package1')

I solved my problem using cont to define path

const sharedPath = env.LAYER_PATH || '/opt/nodejs/apiDashgo.js';

const dashgo = require(sharedPath);

rooleek commented 3 years ago

Has this ever been solved? This module tries to import files from unexisting during deploy folders(layers folders). how to solve that?