无服务器错误TypeError:无法读取未定义的属性'toLowerCase‘

您所在的位置:网站首页 无法读取未定义的属性是什么问题啊 无服务器错误TypeError:无法读取未定义的属性'toLowerCase‘

无服务器错误TypeError:无法读取未定义的属性'toLowerCase‘

2024-07-17 02:30| 来源: 网络整理| 查看: 265

我试着从serverless部署类似this example的东西。在构建我的serverless.yml时,我遇到了这个错误,我找不到要处理的句柄:

代码语言:javascript复制service: products-api package: artifact: target\products-api-dev.jar #artifact: target\${self:service}-${self:provider.stage}.jar #cool alternative :) provider: name: aws runtime: java8 #Copy-pasted resources: Resources: productsTable: Type: AWS::DynamoDB::Table Properties: TableName: products_table AttributeDefinitions: - AttributeName: id AttributeType: S - AttributeName: name AttributeType: S KeySchema: - AttributeName: id KeyType: HASH - AttributeName: name KeyType: RANGE ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1 functions: listProducts: handler: com.serverless.ListProductsHandler events: - http: path: /products method: get getProduct: handler: com.serverless.GetProductHandler events: - http: path: /products/{id} method: get createProduct: handler: com.serverless.CreateProductHandler events: - http: path: /products method: post deleteProduct: handler: com.serverless.DeleteProductHandler events: - http: path: /products/{id}

我得到的错误是这样的--在我自己的代码中没有对错误的引用,这使得我很难找出哪里出了错。我研究了许多Q/A,包括this和this,但它似乎更多的是javascript和typescript的问题,而不是像这里那样的无服务器。

代码语言:javascript复制 Type Error ---------------------------------------------- TypeError: Cannot read property 'toLowerCase' of undefined at AwsCompileApigEvents.getHttpMethod (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:195:24) at C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:50:30 at Array.forEach () at C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:45:37 at Array.forEach () at AwsCompileApigEvents.validate (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\lib\validate.js:44:55) at Object.package:compileEvents [as hook] (C:\snapshot\serverless\lib\plugins\aws\package\compile\events\apiGateway\index.js:318:31) at PluginManager.invoke (C:\snapshot\serverless\lib\classes\PluginManager.js:579:20) at async PluginManager.spawn (C:\snapshot\serverless\lib\classes\PluginManager.js:601:5) at async Object.before:deploy:deploy [as hook] (C:\snapshot\serverless\lib\plugins\deploy.js:60:11) at async PluginManager.invoke (C:\snapshot\serverless\lib\classes\PluginManager.js:579:9) at async PluginManager.run (C:\snapshot\serverless\lib\classes\PluginManager.js:639:7) at async Serverless.run (C:\snapshot\serverless\lib\Serverless.js:452:5) at async C:\snapshot\serverless\scripts\serverless.js:751:9 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3