Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: [serverless-plugin-include-dependencies]: Could not find mssql #45

Open
alihasana opened this issue Jan 6, 2020 · 2 comments
Open

Comments

@alihasana
Copy link

alihasana commented Jan 6, 2020

There is an issue while deploy.

I am using knex with client mysql, but serverless plugin include dependencies are requesting all client module(pg, mssql, sqlite3, mysql2 etc..) one by one.

Please note client is clearly mention as mysql

call Knex

require('mysql');
const knex = require('knex')({
  client: 'mysql',
  connection: {
    host: process.env.DATABASE_HOST,
    port: process.env.DATABASE_PORT,
    user: process.env.DATABASE_USER,
    password: process.env.DATABASE_PASSWORD,
    database: process.env.DATABASE_NAME,
    timezone: process.env.DATABASE_TIMEZONE,
    dateStrings: true,
  },
  pool: {min: 0, max: 1},
});

Error

Error --------------------------------------------------

    Error: [serverless-plugin-include-dependencies]: Could not find mssql
at handle (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:46:17)
at /home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:91:11
at Array.forEach (<anonymous>)
at /home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:90:35
at Array.forEach (<anonymous>)
at module.exports (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:86:66)
at IncludeDependencies.getDependencyList (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:154:12)
at IncludeDependencies.getDependencies (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:139:31)
at IncludeDependencies.processNodeFunction (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:112:33)
at IncludeDependencies.processFunction (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:59:12)
at /home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:41:14
at Array.forEach (<anonymous>)
at IncludeDependencies.createDeploymentArtifacts (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless-plugin-include-dependencies/include-dependencies.js:40:38)
at /home/git/examaple/client.examaple.fr/serverless/notify/node_modules/serverless/lib/classes/PluginManager.js:490:55
at tryCatcher (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/util.js:16:23)
at Object.gotValue (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/reduce.js:168:18)
at Object.gotAccum (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/reduce.js:155:25)
at Object.tryCatcher (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/git/examaple/client.examaple.fr/serverless/notify/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:444:21)
at process.topLevelDomainCallback (domain.js:134:15)

For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

    Get Support --------------------------------------------
    Docs:          docs.serverless.com
Bugs:          github.com/serverless/serverless/issues
Issues:        forum.serverless.com

Your Environment Information ---------------------------
    Operating System:          linux
Node Version:              13.3.0
Framework Version:         1.60.5
Plugin Version:            3.2.7
SDK Version:               2.2.1
Components Core Version:   1.1.2
Components CLI Version:    1.4.0

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `npm install && sls deploy --stage dev`
npm ERR! Exit status 1
npm ERR!
    npm ERR! Failed at the [email protected] deploy script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
npm ERR!     /home/example/.npm/_logs/2020-01-06T08_25_03_361Z-debug.log
@dryror
Copy link
Contributor

dryror commented Jan 27, 2020

I ran into this same problem and tracked it down to that as of v2.0.1 of knex they are using the new peerDependenciesMeta property in their package.json file:

  "peerDependencies": {
    "mssql": "^5.1.0",
    "mysql": "^2.17.1",
    "mysql2": "^2.1.0",
    "pg": "^7.17.0",
    "sqlite3": "^4.1.1"
  },
  "peerDependenciesMeta": {
    "mssql": {
      "optional": true
    },
    "mysql": {
      "optional": true
    },
    "mysql2": {
      "optional": true
    },
    "pg": {
      "optional": true
    },
    "sqlite3": {
      "optional": true
    }
  },

The dependencies parser in this plugin doesn't support this structure, so thinks that all of the peer dependencies listed should be installed and fails the build as a result.

@dryror
Copy link
Contributor

dryror commented Jan 27, 2020

Looks like #44 would take care of this. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants