-
Notifications
You must be signed in to change notification settings - Fork 417
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 when packager is yarn #369
Comments
I've also noticed the same behavior, but only when I use local packages with the file: reference in my package.json |
@bazaglia @mzmiric5 This is intended behavior. The plugin sets You should check, if your yarn.lock file is up-to-date and matches everything that is in your package.json. If you change your package.json manually, they are out of sync and the packaging will fail. As long as you do a However, I can add an option like
That might be a small different bug in the plugin because local references are rebased. I think the package lock file is not rebased properly in that case. |
@HyperBrain oh yeah, I mean I totally agree that frozen lockfile should be a feature that is used for build stability, and in my case, if I just run the exact same yarn command outside of the serverless build process, I don't get this error. I guess I can make a separate issue regarding this since it seems to be affecting npm as well for me (which I was about to do anyway but I saw this issue, and it was describing the same final output I was getting so I tagged along). |
Yes, please do that. Then the file reference/lock issue can be solved separately. |
In my case, I'm not using local references. But while reading the output from serverless deployment, I just found out what was happening. In the list of modules in Regarding the discussion above, the Thank you @mzmiric5 and @HyperBrain. |
I'm getting this same issue, but with no local modules and with a If I remove |
That's expected because then you'll end up without external modules and everything will be packaged. Can you check if you have some dependencies in |
@HyperBrain thank you for the unbelievably quick response! Perhaps I'm confused about what should be considered a |
I don't mean the tools, but other dependencies that are runtime dependencies. A sample for that is e.g. To further debug your problem, you could inspect the package.json files that were created in |
I was having the same problem ☝️ Something that I noticed, is that the
all other modules have a version. Adding But adding |
I'm running into a similar issue, so I checked my {
"name": "sib-helpers-server",
"version": "1.0.0",
"description": "Packaged externals for sib-helpers-server",
"private": true,
"scripts": {},
"dependencies": {
"source-map-support": "",
"babel-runtime": "",
"axios": "0.18.0",
"dotenv": "6.0.0",
"moment": "2.22.2",
"@google-cloud/storage": "2.1.0",
"aws-sdk": "2.334.0"
}
} Here is the package.json: "devDependencies": {
"@jimdo/serverless-dotenv": "1.0.0",
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
"babel-plugin-source-map-support": "2.0.1",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.7.0",
"babel-preset-stage-2": "6.24.1",
"nodemon": "1.18.4",
"serverless": "1.32.0",
"serverless-offline": "3.27.0",
"serverless-plugin-aws-alerts": "1.2.4",
"serverless-webpack": "5.2.0",
"webpack": "4.20.2",
"webpack-node-externals": "1.7.2"
},
"dependencies": {
"@google-cloud/storage": "2.1.0",
"adm-zip": "0.4.11",
"aws-sdk": "2.334.0",
"axios": "0.18.0",
"copy-webpack-plugin": "4.5.4",
"dotenv": "6.0.0",
"fast-crc32c": "1.0.4",
"jest": "23.6.0",
"json2csv": "4.2.1",
"jszip": "3.1.5",
"lodash.map": "4.6.0",
"lodash.uniq": "4.5.0",
"moment": "2.22.2",
"yargs": "12.0.2"
} I don't understand why Here is my {
"plugins": [
"source-map-support",
"transform-runtime"
],
"presets": [
"env",
"stage-2"
]
} Any idea? I tried deleting/recreating the yarn.lock as well but didn't fix anything. -- Edit: We fixed it by using babel-runtime and source-map-support as dependencies, I don't really understand why it works this way, it's very confusing to say the least. "devDependencies": {
"aws-sdk": "2.354.0",
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
"babel-loader": "7.1.5",
"babel-plugin-source-map-support": "1.0.0",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.7.0",
"babel-preset-stage-2": "6.24.1",
"nodemon": "1.18.4",
"serverless": "1.32.0",
"serverless-offline": "3.27.0",
"serverless-plugin-aws-alerts": "1.2.4",
"serverless-webpack": "5.2.0",
"webpack": "4.20.2",
"webpack-node-externals": "1.7.2"
},
"dependencies": {
"@google-cloud/storage": "2.1.0",
"@jimdo/serverless-dotenv": "1.0.0",
"adm-zip": "0.4.11",
"axios": "0.18.0",
"babel-runtime": "6.26.0",
"copy-webpack-plugin": "4.5.4",
"dotenv": "6.1.0",
"fast-crc32c": "1.0.4",
"jest": "23.6.0",
"json2csv": "4.2.1",
"jszip": "3.1.5",
"lodash.map": "4.6.0",
"lodash.uniq": "4.5.0",
"moment": "2.22.2",
"source-map-support": "0.4.18",
"yargs": "12.0.2"
} |
FWIW i've also noticed this if I'm using a dependency that a module included but I didn't explicitly add as a dependency. E.g. I have in one of my files:
it isn't in my package.json, but I get this ok because it comes via On
but if i do I suspect it is good practice to have as package dependencies the modules you explicitly use in your package, e.g. you shouldn't be able to import 'lodash' just because some module you use has it as a dependency. However, why |
@clarsen Confirmed I just ran into the same issue. Mine was a difference in: import { gql } from 'apollo-server-core';
// vs.
import { gql } from 'apollo-server-lambda'; Where |
When you got error, open RESOLVED |
It also happens when you have a dependency on node_modules, but it's not in the package.json (example dotenv, many third party libraries use it). you must add it to your package.json |
The noFrozenLockfile option would be very useful for a project I am currently working on. Do you know when it will be released? |
I was able to generate this error on my typescript app, and was able to resolve by removing 2 "compilerOptions" in my tsconfig.json
|
This is a Bug Report
Description
When using nodeExternals in webpack config, deployment throws an error. The issue is only reproduced with
includeModules: true
+packager: 'yarn'
.It may help because the deployment only include production packages, which causes a difference in yarn lockfile.
Additional Data
The text was updated successfully, but these errors were encountered: