SAM deploy: do not require CodeUri if InlineCode is present
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
**Describe the bug**
With a resource of type `AWS::Serverless::Function`, when using the `InlineCode` property and not setting `CodeUri`, upon deploying, the following error occurs:
```
Missing or invalid value in Template for key: CodeUri
An error occurred while deploying a SAM Application. Check the logs for more information by running the "View AWS Toolkit Logs" command from the Command Palette.
```
**To Reproduce**
1. In `template.yml`, create a resource like:
```yml
rStringSplitterFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
import json
import cfnresponse
def lambda_handler(event, context):
responseData = {"Data": "hello world"}
cfnresponse.send(event, context, cfnresponse.SUCCESS, responseData)
Handler: index.lambda_handler
Runtime: python3.6
```
2. From the Toolkit select `Deploy SAM Application`
**Expected behavior**
Expected the application to deploy, like when I use `sam build && sam deploy --guided` from the terminal.
**Desktop (please complete the following information):**
- OS: Darwin x64 18.7.0
- Visual Studio Code Version: 1.45.1
- AWS Toolkit Version: 1.9.0
Contributor guide
Research direction
Start with the template.yml example and reproduce the failure using Deploy SAM Application in the AWS Toolkit, then compare it with sam build && sam deploy --guided. Trace the deployment path that reports “Missing or invalid value in Template for key: CodeUri.” Done means an AWS::Serverless::Function using InlineCode without CodeUri deploys successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100