Node.js 调试';无服务器网页包';:GraphQL错误:Lambda服务publishService在调用期间引发错误
正在使用“无服务器Web包”,尝试部署。我发布了Node.js 调试';无服务器网页包';:GraphQL错误:Lambda服务publishService在调用期间引发错误,node.js,deployment,webpack,aws-lambda,serverless-framework,Node.js,Deployment,Webpack,Aws Lambda,Serverless Framework,正在使用“无服务器Web包”,尝试部署。我发布了SLS\u DEBUG=*SLS deploy--verbose,一切正常,直到: Serverless: Couldn't publish this deploy information to the Serverless Platform. Error -------------------------------------------------- GraphQL error: Lambda services-publishSe
SLS\u DEBUG=*SLS deploy--verbose
,一切正常,直到:
Serverless: Couldn't publish this deploy information to the Serverless Platform.
Error --------------------------------------------------
GraphQL error: Lambda services-publishService threw an Error during invocation
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: GraphQL error: Lambda services-publishService threw an Error during invocation
at new ApolloError (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/apollo-client/apollo.umd.js:1975:28)
at /Users/jamesfishwick/Documents/get-mobile-screen/node_modules/apollo-client/apollo.umd.js:2889:33
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From previous event:
at fetchEndpoint.then.endpoint (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/plugins/platform/platform.js:168:16)
From previous event:
at provider.getAccountId.then.accountId (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/plugins/platform/platform.js:119:51)
From previous event:
at Platform.publishService (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/plugins/platform/platform.js:118:41)
at BbPromise.reduce (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/classes/PluginManager.js:261:55)
From previous event:
at PluginManager.invoke (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/classes/PluginManager.js:261:22)
at PluginManager.run (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/classes/PluginManager.js:292:17)
at variables.populateService.then (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
From previous event:
at Serverless.run (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/Users/jamesfishwick/Documents/get-mobile-screen/node_modules/serverless/bin/serverless:39:50)
at <anonymous>
我的“webpack.config.js”是:
(相关)“serverless.yml”是:
我认为问题在于apollo客户端库使用rollup生成UMD。。。而webpack在UMD上遇到了问题。太好了,你是做什么的
网页包插件可能会修复它。如果不是。。。你能分享使用apollo客户端的代码吗?你用SLS_DEBUG=*再次运行了吗?是的,请看第一句话。对不起,我的错。我转换了sls和*。您可以尝试从无服务器平台注销吗
sls注销
,然后重试。这无疑会对某些人有所帮助。将来可能是我;)问题实际上是无服务器Web包中的一个bug
{
"plugins": ["transform-runtime", "ramda"],
"presets": [
[
"env",
{
"targets": {
"node": "6.10"
},
"modules": false,
"loose": true,
"debug": true
}
]
]
}
var nodeExternals = require('webpack-node-externals');
module.exports = {
entry: './handler.js',
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
target: 'node',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/, // in order to ignore built-in modules like path, fs, etc.
loaders: ['babel-loader'],
include: __dirname,
},
],
},
};
service: get-mobile-screen
provider:
name: aws
runtime: nodejs6.10
custom:
webpackIncludeModules:
packagePath: './package.json'
functions:
index:
handler: handler.getMobileScreen
events:
- http: GET getMobileScreen
plugins:
- serverless-webpack
- serverless-offline