serverless-plugin-include-dependencies
serverless-plugin-include-dependencies copied to clipboard
Not adding dependency
Hi,
I have a strange case.
In my package.json I have:
"dependencies": { "mysql2": "^1.6.4", "sequelize": "^4.41.2" },
When I run "npm list" before "sls deploy" I get this:
[email protected] /opt/atlassian/pipelines/agent/build +-- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected]
| +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected]
| +-- [email protected]
| | -- [email protected] | | +-- [email protected] | |
-- [email protected]
| +-- [email protected]
| -- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | |
-- [email protected]
| +-- [email protected]
| | -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected] deduped
| +-- [email protected]
| | +-- [email protected] deduped
| | -- [email protected] | |
-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- @types/[email protected]
| | -- [email protected] | |
-- @types/[email protected] deduped
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| -- [email protected] |
-- @types/[email protected]
-- [email protected] +-- [email protected] . . .
But when the package deployed it doesn't have the mysql2 module.
I've tried to add
custom: includeDependencies: always: - 'node_modules/mysql2/**'
to serverless.yaml, but then I've got the following error while building the package:
Error: [serverless-plugin-include-dependencies]: Could not find cardinal at handle (/opt/atlassian/pipelines/agent/build/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:52:17)
Seems like mysql2 has an optional dependency of cardinal and that's causing the issue at the second time. Maybe it's the reason why it isn't included automatically.
Could you help me figuring this out?
I have a project that's using the config
package. It gets added properly when I'm using node 8 (8.11.4), but when I tried to upgrade to node 10 (10.16.3) it quit including that package.
@openam I don't think your issue is related to this. I filed a new ticket for your issue here: https://github.com/dougmoscrop/serverless-plugin-include-dependencies/issues/46
Hi,
I have a strange case. In my package.json I have:
"dependencies": { "mysql2": "^1.6.4", "sequelize": "^4.41.2" },
When I run "npm list" before "sls deploy" I get this:
[email protected] /opt/atlassian/pipelines/agent/build +-- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected] | +-- [email protected] | |-- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected] | +-- [email protected] | |-- [email protected] | | +-- [email protected] | |
-- [email protected] | +-- [email protected] |-- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | |
-- [email protected] | +-- [email protected] | |-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | |
-- [email protected] deduped | +-- [email protected] | | +-- [email protected] deduped | |-- [email protected] | |
-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- @types/[email protected] | |-- [email protected] | |
-- @types/[email protected] deduped | +-- [email protected] | +-- [email protected] | +-- [email protected] |-- [email protected] |
-- @types/[email protected]-- [email protected] +-- [email protected] . . .
But when the package deployed it doesn't have the mysql2 module.
I've tried to add
custom: includeDependencies: always: - 'node_modules/mysql2/**'
to serverless.yaml, but then I've got the following error while building the package:
Error: [serverless-plugin-include-dependencies]: Could not find cardinal at handle (/opt/atlassian/pipelines/agent/build/node_modules/serverless-plugin-include-dependencies/get-dependency-list.js:52:17)
Seems like mysql2 has an optional dependency of cardinal and that's causing the issue at the second time. Maybe it's the reason why it isn't included automatically.
Could you help me figuring this out?
@KundK I'm facing the same issue. Have you found the solution?
@92nishant I have, but can't remember exactly what was it. And I don't have access to that code anymore.
Sorry!
@92nishant you may try adding something similar in your handler. This fixed it for me:
// DO NOT REMOVE.
// serverless include dependencies plugin removes mysql2 required by knex
// this is added to ensure this dependency is included
// eslint-disable-next-line no-unused-vars
const mysql2 = require('mysql2');