0
votes

I am trying to create a python function that can be deployed into lambda BUT using Bazel.

I am able to create the binary file with Bazel (that runs my python code) but when I am trying to execute that binary in AWS Lambda it fails rudely.

Binary does not have the expected method signature for the lambda handler function.

This is my BUILD file:

py_binary(
    name = 'say_hello',
    main = 'main.py',
    srcs = ['main.py']
)

This is main.py:

def say_hello(event, context):
   print('hello')

How can I force Bazel to "accept" this method signature?

1
Why do you want to build your python program into binary? - jellycsc
We are trying to work with this idea of "monorepo"(medium.com/@Jakeherringbone/…) and using bazel to ensure that nothing will break during this. - alanmas

1 Answers

0
votes

I found a solution for this and was creating like a python "bridge" that will take input values from cloudwatch rule and then execute python binary (bazel one).

So in python lambda I will have 2 files, actual binary and the bazel bridge. As lambda is always expecting that method signature.