现在这对我有用,但是它破坏了使用serverless.template(JSON)来构建我的API的自动化.有谁知道如何在serverless.template文件中解决此问题?这样我就无需在控制台中采取任何措施来解决?这是我来自serverless.template文件的一种方法的示例{ "AWSTemplateFormatVersion" : "2010-09-09", "Transform" : "AWS::Serverless-2016-10-31", "Description" : "An AWS Serverless Application.", "Resources" : { "Get" : { "Type" : "AWS::Serverless::Function", "Properties": { "VpcConfig":{ "SecurityGroupIds" : ["sg-111a1476"], "SubnetIds" : [ "subnet-3029a769","subnet-5ec0b928"] }, "Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::Get", "Runtime": "dotnetcore2.0", "CodeUri": "", "MemorySize": 256, "Timeout": 30, "Role": null, "Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"], "Events": { "PutResource": { "Type": "Api", "Properties": { "Path": "/", "Method": "GET" } } } } },解决方案我有一个类似的问题-我删除了然后重新安装了lambda函数.我的API网关仍然指向旧的API,因此我不得不进入API网关并更改资源方法"以更改集成请求"设置以指向新的API(它似乎指向正确的API,但是没有就我而言)I am building a serverless application using AWS Lambda and API Gateway via Visual Studio. I am working in C#, and using the serverless application model (SAM) in order to deploy my API. I build the code in Visual Studio, then deploy via publish to Lambda. This is working, except every time I do a new build, and try to execute an API call, I get this error:Execution failed due to configuration error: Invalid permissions on Lambda functionDoing some research, I found this fix mentioned elsewhere (to be done via the AWS Console):Fix: went to API Gateway > API name > Resources > Resource name > Method > Integration Request > Lambda Function and reselected my existing function, before "saving" it with the little checkmark.Now this works for me, but it breaks the automation of using the serverless.template (JSON) to build out my API. Does anyone know how to fix this within the serverless.template file? So that I don't need to take action in the console to resolve? Here's a sample of one of my methods from the serverless.template file{ "AWSTemplateFormatVersion" : "2010-09-09", "Transform" : "AWS::Serverless-2016-10-31", "Description" : "An AWS Serverless Application.", "Resources" : { "Get" : { "Type" : "AWS::Serverless::Function", "Properties": { "VpcConfig":{ "SecurityGroupIds" : ["sg-111a1476"], "SubnetIds" : [ "subnet-3029a769","subnet-5ec0b928"] }, "Handler": "AWSServerlessInSiteDataGw::AWSServerlessInSiteDataGw.Functions::Get", "Runtime": "dotnetcore2.0", "CodeUri": "", "MemorySize": 256, "Timeout": 30, "Role": null, "Policies": [ "AWSLambdaBasicExecutionRole","AWSLambdaVPCAccessExecutionRole","AmazonSSMFullAccess"], "Events": { "PutResource": { "Type": "Api", "Properties": { "Path": "/", "Method": "GET" } } } } }, 解决方案 I had a similar issue - I deleted then re-installed a lambda function. My API Gateway was still pointing at the old one, so I had to go into the API Gateway and change my Resource Methods to alter the Integration Request setting to point to the new one (it may look like it's pointing to the correct one but wasn't in my case) 这篇关于由于配置错误,执行失败:Lambda函数的权限无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-13 14:34