Skip to content

Lambda Function zipFile Error #2223

@urton

Description

@urton

When trying to use Python code inline via zipFile, I get the following error:

The Function "myfunction" is invalid: spec.code.zipFile: Invalid value: "def lambda_handler(event, context):\n    print('hello world')\n": spec.code.zipFile in body must be of type byte: "def lambda_handler(event, context):\n    print('hello world')\n"

My Function YAML:

---
apiVersion: lambda.services.k8s.aws/v1alpha1
kind: Function
metadata:
  name: myfunction
  namespace: devops-automation
spec:
  code: 
    zipFile: |
      def lambda_handler(event, context):
          print('hello world')
  environment: 
    variables: {}
  fileSystemConfigs:
  - arn: "arn:aws:elasticfilesystem:us-west-1:*****:access-point/fsap-*****"
    localMountPath: "/mnt/efs"
  handler: "index.lambda_handler"
  memorySize: 256
  name: myfunction
  publish: false
  reservedConcurrentExecutions: 100
  role: "arn:aws:iam::*****:role/*****"
  runtime: python3.12
  tags: {}
  timeout: 30
  vpcConfig: 
    securityGroupIDs:
    - sg-*****
    subnetIDs:
    - subnet-*****
    - subnet-*****

Metadata

Metadata

Assignees

Labels

lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.service/lambdaIndicates issues or PRs that are related to lambda-controller.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions