AWS SAM package Parameter CodeUri refers to a file or folder that does not exist

Viewed 20

I am trying to deploy a lambda function to AWS via codepipeline. In the pipeline I have a codebuild step which uses SAM to build the function and package it into an S3 bucket. I keep getting the following error

Error: Unable to upload artifact LambdaMultiRegion referenced by CodeUri parameter of LambdaMultiRegion resource.
Parameter CodeUri of resource LambdaMultiRegion refers to a file or folder that does not exist /codebuild/output/src259622855/src/.aws-sam/build/LambdaMultiRegion

I have confirmed that the bucket does exist and codebuild's IAM role has access to it. Buildspec file looks like this

version: 0.2
phases:
 install:
    runtime-versions:
      python: 3.7
 build: 
  commands:
   - sam build
   - sam package --s3-bucket poc-lambdamultiregion --output-template-file outputtemplate.yml
artifacts:
 files:
  - template.yml
  - outputtemplate.yml

template file

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Python function
Resources:
 LambdaMultiRegion:
  Type: AWS::Serverless::Function
  Properties:
   Handler: Index.lambda_handler
   Runtime: python3.7
   FunctionName: PoC-LambdaMultiRegion
   CodeUri: ./src 

Any idea why sam cannot put the package in S3 bucket?

0 Answers
Related