Open 0x62 opened 4 years ago
package.json:
"devDependencies": {
"@babel/cli": "^7.7.4",
"@babel/core": "^7.7.4",
"@babel/preset-env": "^7.7.4",
"babel-loader": "^8.0.6",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-source-map-support": "^2.1.1",
"eslint-import-resolver-babel-module": "^5.1.0",
"serverless-dotenv-plugin": "^2.1.1",
"serverless-offline": "^5.12.0",
"serverless-webpack": "5.3.1",
"webpack": "^4.41.2",
"webpack-node-externals": "^1.7.2"
},
"dependencies": {
"@mux/mux-node": "^2.5.0",
"@sentry/node": "^5.15.4",
"@sentry/webpack-plugin": "^1.10.0",
"@zeit/fetch": "^5.1.1",
"apollo-cache-inmemory": "^1.6.3",
"apollo-client": "^2.6.4",
"apollo-errors": "^1.9.0",
"apollo-link-error": "^1.1.12",
"apollo-link-http": "^1.5.16",
"apollo-server-lambda": "^2.9.12",
"aws-s3-form": "^0.3.5",
"aws-sdk": "^2.585.0",
"dinero.js": "^1.6.0",
"firebase-admin": "^8.8.0",
"git-rev-sync": "^2.0.0",
"graphql-tag": "^2.10.1",
"graphql-tools": "^4.0.6",
"i": "^0.3.6",
"ioredis": "^4.16.1",
"jsonwebtoken": "^8.5.1",
"moment": "^2.24.0",
"npm": "^6.14.4",
"p-iteration": "^1.1.8",
"recombee-api-client": "^2.4.1",
"redlock": "^4.1.0",
"request": "^2.88.0",
"source-map-support": "^0.5.16",
"stream": "0.0.2",
"stripe": "^7.14.0",
"uuid": "^3.3.3"
}
serverless.yml (functions/resources redacted):
# Custom config options
custom:
webpack:
includeModules: true
config: ${file(env.${self:provider.stage}.yml)}
# Provider configuration
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
region: us-east-1
environment: ${self:custom.config}
# Plugins
plugins:
- serverless-webpack
- serverless-offline
# Package each function individually
package:
individually: true
What kind of output are you expecting?
serverless package
will create zip packages in the folder .serverless
Are you saying those zip folders are empty or are there no zipped packages at all?
@soda0289 Empty except for the CloudFormation template, no zipped packages at all. No console messages, ends at the same point as the log above.
I've tried reverting to a known good commit from last week, and get the same result. Current line of thinking is possibly related to a dependency that has introduced a bug in a minor update?
Tested removing the Sentry plugin, no luck.
Builds successfully with custom.webpack.includeModules: false
, but throws an error at runtime (serverless/serverless#7566).
This problem might be related to an uncaught promise rejection or some race condition between promises.
The includeModules
flags just tells this plugin to run npm/yarn to create the node_modules folder for each zip bundle. If you wanted to set includeModules
to false you would need to bundle in all the external modules, by remove externals: [nodeExternals()]
from webpack config. This might be a workaround for you or other people with this issue.
I will look into this and try to reproduce the issue. Are those warnings about "Could not determine version of module" a normal thing or did it start to happen when builds stared to failed?
Serverless: Packing external modules:
graphql-tag@^2.10.1,
graphql,
source-map-support@^0.5.16,
stripe@^7.14.0,
uuid@^3.3.3,
apollo-errors@^1.9.0,
@mux/mux-node@^2.5.0,
firebase-admin@^8.8.0,
p-iteration@^1.1.8,
jsonwebtoken@^8.5.1,
apollo-link,
dinero.js@^1.6.0,
apollo-server-lambda@^2.9.12,
graphql-tools@^4.0.6,
@zeit/fetch@^5.1.1,
@types/node-fetch,
node-fetch,
apollo-client@^2.6.4,
apollo-cache-inmemory@^1.6.3,
apollo-link-http@^1.5.16,
apollo-link-error@^1.1.12,
request@^2.88.0,
aws-sdk@^2.585.0,
aws-s3-form@^0.3.5,
ioredis@^4.16.1,
redlock@^4.1.0,
@sentry/node@^5.15.4,
lodash,
moment@^2.24.0,
recombee-api-client@^2.4.1
It seems to be missing versions for packages graphql, apollo-link, node-fetch, lodash
. Which might be peer dependencies of some of your packcages, such as @zeit/fetch
or apollo-client
. You can try adding the missing peer dependencies and see if that fixes the issue or eliminates the warnings.
@soda0289 Cheers for your help. Could not determine version messages have been there as long as I can remember, and never caused issues.
Building with includeModules: false
, and removing externals
throws errors at package with the following log:
ERROR in ./node_modules/graphql/index.mjs 42:0-48:205
Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
@ ./node_modules/graphql-tools/dist/makeExecutableSchema.js
@ ./node_modules/graphql-tools/dist/index.js
@ ./src/graphql/schema.js
@ ./src/graphql/index.js
@ multi ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js ./src/graphql/index.js
[many similar (default export only) errors omitted]
ERROR in ./node_modules/google-gax/build/src/operationsClient.js
Module not found: Error: Can't resolve './operations_client_config' in '/Users/benlewis/projects/hearsay/server/node_modules/google-gax/build/src'
@ ./node_modules/google-gax/build/src/operationsClient.js 36:19-56
@ ./node_modules/google-gax/build/src/index.js
@ ./node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js
@ ./node_modules/@google-cloud/firestore/build/src/v1/index.js
@ ./node_modules/@google-cloud/firestore/build/src/index.js
@ ./node_modules/firebase-admin/lib/firebase-namespace.js
@ ./node_modules/firebase-admin/lib/default-namespace.js
@ ./node_modules/firebase-admin/lib/index.js
@ ./src/shared/db/firebase.js
@ ./src/graphql/resolvers/auth/mutations/password-reset.js
@ ./src/graphql/resolvers/auth/index.js
@ ./src/graphql/schema.js
@ ./src/graphql/index.js
@ multi ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js ./src/graphql/index.js
ERROR in ./node_modules/@firebase/database/dist/index.esm.js
Module not found: Error: Can't resolve '@firebase/app' in '/Users/benlewis/projects/hearsay/server/node_modules/@firebase/database/dist'
@ ./node_modules/@firebase/database/dist/index.esm.js 1:0-37 15117:17-25
@ ./node_modules/firebase-admin/lib/firebase-namespace.js
@ ./node_modules/firebase-admin/lib/default-namespace.js
@ ./node_modules/firebase-admin/lib/index.js
@ ./src/shared/db/firebase.js
@ ./src/graphql/resolvers/auth/mutations/password-reset.js
@ ./src/graphql/resolvers/auth/index.js
@ ./src/graphql/schema.js
@ ./src/graphql/index.js
@ multi ./node_modules/@sentry/webpack-plugin/src/sentry-webpack.module.js ./src/graphql/index.js
I've installed specific versions of the packages, but no changes to the output:
delta:server benlewis$ npm i -s graphql apollo-link node-fetch lodash
+ lodash@4.17.15
+ graphql@15.0.0
+ node-fetch@2.6.0
+ apollo-link@1.2.14
I've been able to track down the package causing the issue.
Requiring git-rev-sync in webpack.config.js is what's causing it to silently fail.
Here is a demo app showing the issue: sls-err.zip. Running with $ serverless offline
will build successfully and launch a GraphQL server, which you can query ping { pong }
.
Attempting to use deploy/package with webpack.config.js#L6
uncommented will fail silently.
I have 3 serverless repo's all with the same config, more or less. The first two that got this error are substantially smaller in size, and somehow eventually began running fine after a few CI/CD reruns. I checked the logs, cleared caches and made sure everything is as expected. I can't explain this.
However, the larger repository (which also uses a copy-webpack-plugin
) cannot overcome this error.
"serverless": "2.43.1",
"serverless-webpack": "5.5.0",
"webpack": "5.38.1",
"webpack-cli": "4.7.2",
"webpack-node-externals": "3.0.0"
This is a Bug Report
Description
When running via
serverless webpack
,serverless deploy
orserverless package
, the process exits with a successful status code but no bundle output.Similar or dependent issue(s):
Additional Data
Output:
webpack.config.js:
Here is the full output of
SLS_DEBUG=* serverless deploy
: