SAM CLI - Unable to build

I have a project set up for SAM that I cannot assume was correctly set up.

When I try to run sam build --use-container, this happens:

>sam build --use-container
Starting Build inside a container
Building codeuri: /...whatever.../hello_world runtime: python3.7 metadata: {} functions: ['HelloWorldFunction']

Fetching public.ecr.aws/sam/build-python3.7:latest Docker container image......
Mounting /...whatever.../hello_world as /tmp/samcli/source:ro,delegated inside runtime container

Build Failed
Running PythonPipBuilder:ResolveDependencies
Error: PythonPipBuilder:ResolveDependencies - Requirements file not found: /tmp/samcli/source/requirements.txt

I'm not surprised that it can't find /tmp/samcli/source/requirements.txt, because it does not exist. Instead, I would expect it to look in ./main/requirements.txt, which is there.

Here is my template file:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  my-service

Globals:
  Function:
    Timeout: 3

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: hello_world/
      Handler: app.lambda_handler
      Runtime: python3.7
      Events:
        HelloWorld:
          Type: Api
          Properties:
            Path: /hello
            Method: get

Outputs:
  HelloWorldApi:
    Description: "API Gateway endpoint URL for Prod stage for Hello World function"
    Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
  HelloWorldFunction:
    Description: "Hello World Lambda Function ARN"
    Value: !GetAtt HelloWorldFunction.Arn
  HelloWorldFunctionIamRole:
    Description: "Implicit IAM Role created for Hello World function"
    Value: !GetAtt HelloWorldFunctionRole.Arn
                                                     

What could be the reason for this error?



from Recent Questions - Stack Overflow https://ift.tt/2Swh46a
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)