Errno 20 Not a directory: '/tmp/tmp6db1q_sn/pyproject.toml/egg-info'

Viewed 26

I'm wrapping my colleague's code in an AWS SAM. I made a lambda to just call existing code with a run method which I did like this.

import json
from sentance_analyser_v2.main import run

def lambda_handler(event, context):
    if (event['path'] == '/analyse'):
        return RunAnalyser(event, context)
    else:
        return {
            "statusCode": 200,
            "body": json.dumps({
                "message": "Hello"
                }),
        }

def RunAnalyser(event, context):
    source = event['queryStringParameters']['source']
    output = run(source)
    return {
        "statusCode": 200,
        "body": json.dumps({
            "output": json.dumps(output)
        })
    }

After running into numerous package problems I realized I forget to use the sam build --use-container command and I was hoping after a build it would solve some of my package errors but I ran into this error code -

Error: PythonPipBuilder:ResolveDependencies - [Errno 20] Not a directory: '/tmp/tmp6db1q_sn/pyproject.toml/egg-info'

After trying to understand what the freak that even is I started pulling my hairs out because there is nothing on this...

Here is the basic template that I currently use just so I can test that my wrapping worked. I'm still very new to AWS & SAM so I don't want to overcomplicate things just yet with the template.

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  sam-app

  Sample SAM Template for sam-app

Globals:
  Function:
    Timeout: 30
    Tracing: Active
  Api:
    TracingEnabled: True

Resources:
  MainLambda: 
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: main_lambda/
      Handler: app.lambda_handler
      Runtime: python3.9
      Architectures:
        - x86_64
      Events:
        Analyser:
          Type: Api
          Properties:
            Path: /analyse
            Method: get

Outputs:
  HelloEfsApi:
    Description: "API Gateway endpoint URL for Prod stage for Hello EFS function"
    Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"

0 Answers
Related