serverless-webpack: Deployment missing git packages
This is a Bug Report
Description
Git packages not being included on deployment.
In package.json I have a package included via git "my-package": "git+ssh://git@my-git-location.com/my-git-package.git#master".
This has been working fine for months but all of a sudden it would seem that my package is not being bundled on deployment, but working fine when invoking locally.
If I download the function from Lambda I can see that my package is missing from the node_modules folder.
Config
.babelrc
{
"plugins": [
"transform-runtime"
],
"presets": [
"es2015",
"stage-3"
]
}
serverless.yml
...
plugins:
- serverless-webpack
custom:
webpackIncludeModules: true
...
webpack.config.js
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
// Since 'aws-sdk' is not compatible with webpack,
// we exclude all node dependencies
externals: [nodeExternals()],
// Run babel on all .js files and skip those in node_modules
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
include: __dirname,
exclude: /node_modules/,
}],
},
};
Additional Data
- Serverless-Webpack Version you’re using: 4.1.0
- Webpack version you’re using: 3.10.0
- Serverless Framework Version you’re using: 1.24.1
- Operating System: OSX
$ serverless deploy --stage=##REMOVED##
Serverless: Bundling with Webpack...
Time: 600ms
Asset Size Chunks Chunk Names
handlers/get.js 5.47 kB 0 [emitted] handlers/get
[0] ./handlers/get.js 2.54 kB {0} [built]
[1] external "babel-runtime/regenerator" 42 bytes {0} [not cacheable]
[2] external "babel-runtime/helpers/asyncToGenerator" 42 bytes {0} [not cacheable]
[3] external "aws-sdk" 42 bytes {0} [not cacheable]
[4] external "my-package" 42 bytes {0} [not cacheable]
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: babel-runtime@^6.26.0, aws-sdk@^2.165.0, git+ssh://git@my-git-location.com/my-git-package.git#master
Serverless: Packaging service...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..........
Serverless: Stack update finished...
Service Information
service: ###REMOVED###
stage: ###REMOVED###
region: ###REMOVED###
stack: ###REMOVED###
api keys:
None
endpoints:
GET - ###REMOVED###
functions:
get: ###REMOVED###
Serverless: Removing old service versions...
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (12 by maintainers)
I investigated the changelogs for npm 5.7.1 and saw that the git fix as well as some prune fixes were in there. I also saw, that they did not comment the old open tasks and inform users that this might be closed. So I’d propose that we do some tests with
npm@5.7.1to see if the problem is fixed. If it is, we can add a section for supported npm versions to the docs (<5.5 && >=5.7.1)I think I found it: https://github.com/npm/npm/issues/19356
The plugin does a
npm pruneto remove not used packages per function. Due to the NPM bug, it will errorneously remove the git packages.I’m still having this same issue, when I try to include a git module with serverless-webpack and then require() it in my handler, the module cannot be found. Any help would be very appreciated