Fork me on GitHub
#holy-lambda
<
2022-06-03
>
Chris Lowe10:06:57

I have a lambda with a Babashka runtime but it’s failing at runtime:

1: (ns example.core
2022-06-03T10:39:54.221+01:00	2: (:gen-class)
2022-06-03T10:39:54.221+01:00	3: (:require
2022-06-03T10:39:54.221+01:00	^--- Could not find namespace: fierycod.holy-lambda.response.
2022-06-03T10:39:54.221+01:00	4: [babashka.pods :as pods]
2022-06-03T10:39:54.221+01:00	5: [fierycod.holy-lambda.response :as hr]
2022-06-03T10:39:54.221+01:00	6: [fierycod.holy-lambda.core :as h]
2022-06-03T10:39:54.221+01:00	7: ;; shipped with Babashka, hence no dependency in deps.edn
2022-06-03T10:39:54.221+01:00	8: [hiccup.core :as hiccup]))

Chris Lowe10:06:59

the relevant bit in my template.yml

Resources:
  BabashkaDepsLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      LayerName: BabashkaDepsLayer
      ContentUri: ./.holy-lambda/bb-clj-deps

  BabashkaPodsLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      LayerName: BabashkaPodsLayer
      Description: Shared pods for stack.
      ContentUri: ./.holy-lambda/pods
      CompatibleRuntimes:
        - provided.al2

ExampleLambdaFunction:
    Type: AWS::Serverless::Function
    Properties:
      FunctionName: "ExampleLambda"
      Runtime: provided.al2
      Architectures:
        - arm64
      Handler: example.core.ExampleLambda
      CodeUri: src
      Timeout: 40
      MemorySize: 2048
      Events:
        GetEvent:
          Type: HttpApi
          Properties:
            ApiId: !Ref ExampleHttpApi
            Path: /my-path/{id}
            Method: GET
      Layers:
        - !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer:holy-lambda-babashka-runtime-arm64:1"
        - !Ref BabashkaDepsLayer
        - !Ref BabashkaPodsLayer

Chris Lowe10:06:02

I’d deployed the ARM runtime to my account via this link:

Chris Lowe10:06:35

I’m using the HL layer, so it’s strange that the namespace fierycod.holy-lambda.response is reported as something that cannot be found.

Chris Lowe10:06:52

This is using HL 0.6.6 with latest tasks

Karol Wójcik10:06:53

The latest BB runtimes are not shipping HL directly.

Karol Wójcik10:06:12

You have to include the dependency in bb.edn 🙂

Chris Lowe10:06:17

what do I need to include?

Chris Lowe10:06:26

Hmmm - I already have it:

:deps    {org.clojure/clojure                  {:mvn/version "1.11.1"}
           io.github.FieryCod/holy-lambda       {:mvn/version "0.6.6"}
           com.github.clj-easy/graal-build-time {:mvn/version "0.1.4"}}

Chris Lowe10:06:48

I’ll try without the graal-build-time

Chris Lowe10:06:03

I assume Clojure 1.11.1 is ok?

Karol Wójcik10:06:06

Do you have it in bb.edn?

Chris Lowe10:06:57

Nothing explicit for HL in bb.deps

Chris Lowe10:06:26

is there a specific pod I need to add?

Karol Wójcik10:06:27

You need to place io.github.FieryCod/holy-lambda {:mvn/version "0.6.6"} in bb.edn deps

Karol Wójcik10:06:48

This is because for babashka runtime the BB is handling deps not HL tasks

Chris Lowe10:06:36

> This is because for babashka runtime the BB is handling deps not HL. Which is something I always forget!

Chris Lowe10:06:39

Perfect - that worked. Thank you @UJ1339K2B

Karol Wójcik10:06:05

You are very welcome 🙂