FUNCTION_ERROR_INIT_FAILURE AWS 拉姆达
FUNCTION_ERROR_INIT_FAILURE AWS lambda
我最近添加了很棒的 lambda 功能 - 预置并发。
经过几次成功部署后,我现在面临这个问题
Serverless Error ---------------------------------------
ServerlessError: An error occurred:
GraphqlPrivateProvConcLambdaAlias - Provisioned Concurrency
configuration failed to be applied. Reason:
FUNCTION_ERROR_INIT_FAILURE.
at C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:125:33
From previous event:
at AwsDeploy.monitorStack (C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:28:12)
at C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:107:28
From previous event:
at AwsDeploy.update
这是我的示例 serverless.yml 文件
service: backend-api
parameters:
region: ap-southeast-2
path: &path /
provider:
name: aws
runtime: nodejs12.x
stage: ${env:STAGE, 'staging'}
region: ap-southeast-2
versionFunctions: true
plugins:
- serverless-webpack
- serverless-pseudo-parameters
- serverless-prune-plugin
# - serverless-offline-scheduler
- serverless-offline
functions:
# GRAPHQL APIs
graphqlPrivate:
handler: src/graphql/private/index.handler
memorySize: 256
timeout: 30
name: ${self:service}-gqlPrivate-${self:provider.stage}
vpc: ${file(./serverless/vpc.yml)}
events:
- http:
path: /graphql/private
method: ANY
cors: true
authorizer:
arn: arn:aws:cognito-idp:#{AWS::Region}:#{AWS::AccountId}:userpool/${self:custom.cognitoArns.private.${self:provider.stage}}
provisionedConcurrency: 10
package:
individually: true
custom:
webpack:
keepOutputDirectory: true
serializedCompile: true
webpackConfig: 'webpack.config.js'
packager: 'npm'
stage: ${opt:stage, self:provider.stage}
prune:
automatic: true
number: 1
有人能解决这个问题吗?
Your Environment Information ---------------------------
Operating System: win32
Node Version: 12.11.0
Framework Version: 1.61.3
Plugin Version: 3.2.7
SDK Version: 2.3.0
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
FUNCTION_ERROR_INIT_FAILURE 显然意味着我正在尝试部署的函数 handler/code 有问题,w/c 是配置 lambda 的原因无法启动 up/initialize.
解决此问题的方法是先测试 w/o 提供的并发选项。
一旦你能够推送你的 lambda,错误肯定会流入你的 CW 日志。
不过,最好的方法是在本地测试您的 lambda(使用 serverless-offline 插件或 serverless invoke),如果它工作正常。
您还可以打包您的应用程序,并使用无服务器 cli 调用它来检测打包问题。
在我的例子中,有一个运行时错误,我的代码包正在寻找不属于包的 require。
截至目前(2020 年 1 月 29 日),这在 AWS lambda 上尚未记录
我最近添加了很棒的 lambda 功能 - 预置并发。
经过几次成功部署后,我现在面临这个问题
Serverless Error ---------------------------------------
ServerlessError: An error occurred: GraphqlPrivateProvConcLambdaAlias - Provisioned Concurrency configuration failed to be applied. Reason: FUNCTION_ERROR_INIT_FAILURE. at C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:125:33 From previous event: at AwsDeploy.monitorStack (C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\monitorStack.js:28:12) at C:\Users\theod\AppData\Roaming\npm\node_modules\serverless\lib\plugins\aws\lib\updateStack.js:107:28 From previous event: at AwsDeploy.update
这是我的示例 serverless.yml 文件
service: backend-api
parameters:
region: ap-southeast-2
path: &path /
provider:
name: aws
runtime: nodejs12.x
stage: ${env:STAGE, 'staging'}
region: ap-southeast-2
versionFunctions: true
plugins:
- serverless-webpack
- serverless-pseudo-parameters
- serverless-prune-plugin
# - serverless-offline-scheduler
- serverless-offline
functions:
# GRAPHQL APIs
graphqlPrivate:
handler: src/graphql/private/index.handler
memorySize: 256
timeout: 30
name: ${self:service}-gqlPrivate-${self:provider.stage}
vpc: ${file(./serverless/vpc.yml)}
events:
- http:
path: /graphql/private
method: ANY
cors: true
authorizer:
arn: arn:aws:cognito-idp:#{AWS::Region}:#{AWS::AccountId}:userpool/${self:custom.cognitoArns.private.${self:provider.stage}}
provisionedConcurrency: 10
package:
individually: true
custom:
webpack:
keepOutputDirectory: true
serializedCompile: true
webpackConfig: 'webpack.config.js'
packager: 'npm'
stage: ${opt:stage, self:provider.stage}
prune:
automatic: true
number: 1
有人能解决这个问题吗?
Your Environment Information ---------------------------
Operating System: win32
Node Version: 12.11.0
Framework Version: 1.61.3
Plugin Version: 3.2.7
SDK Version: 2.3.0
Components Core Version: 1.1.2
Components CLI Version: 1.4.0
FUNCTION_ERROR_INIT_FAILURE 显然意味着我正在尝试部署的函数 handler/code 有问题,w/c 是配置 lambda 的原因无法启动 up/initialize.
解决此问题的方法是先测试 w/o 提供的并发选项。 一旦你能够推送你的 lambda,错误肯定会流入你的 CW 日志。 不过,最好的方法是在本地测试您的 lambda(使用 serverless-offline 插件或 serverless invoke),如果它工作正常。 您还可以打包您的应用程序,并使用无服务器 cli 调用它来检测打包问题。
在我的例子中,有一个运行时错误,我的代码包正在寻找不属于包的 require。
截至目前(2020 年 1 月 29 日),这在 AWS lambda 上尚未记录