aws / aws/aws-toolkit-azure-devops
The LambdaDeployFunction task suppresses permission errors
- Dominant language
- TypeScript
- Stars
- 258
- Forks
- 114
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The [LambdaDeployFunction ](https://github.com/aws/aws-toolkit-azure-devops/blob/5c3ea378838f82e7aa81842404d944138f033ed3/Tasks/LambdaDeployFunction/TaskOperations.ts#L212)task currently suppresses permission issues, which can mislead the user to the true cause of the error.
**To reproduce**
Use the following task with a role that does not have permission to work with Lambda's
```
- task: LambdaDeployFunction@1
displayName:
inputs:
functionName: my-function
codeLocation: s3object
s3Bucket: bucket
s3ObjectKey: key
```
You will receive the error: `##[error]Error: Function:my-function does not exist, cannot update code only`
Using the `aws-cli` to mimic what the function is trying to do with `aws lambda get-function` you would see:
`An error occurred (AccessDeniedException) when calling the GetFunction operation: User: arn:aws:sts::myrole is not authorized to perform: lambda:GetFunction on resource: my-function`
**Expected behavior**
The permission error should be shown to the user, ideally printed to the console.
**Your Environment**
- AWS Toolkit for Azure DevOps version: 1.7.0
**Additional context**
The function testFunctionExists currently suppresses all errors:
https://github.com/aws/aws-toolkit-azure-devops/blob/5c3ea378838f82e7aa81842404d944138f033ed3/Tasks/LambdaDeployFunction/TaskOperations.ts#L212
Contributor guide
Research direction
Open Tasks/LambdaDeployFunction/TaskOperations.ts and inspect the testFunctionExists function at the linked location. Reproduce the task with a role lacking lambda:GetFunction permission, then verify that the resulting AccessDeniedException is shown to the user instead of being reported as a missing function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100