This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-25
Channels
- # announcements (14)
- # aws (1)
- # babashka (23)
- # beginners (442)
- # calva (50)
- # chlorine-clover (1)
- # cider (32)
- # clojure (124)
- # clojure-europe (35)
- # clojure-france (5)
- # clojure-gamedev (5)
- # clojure-nl (2)
- # clojure-portugal (3)
- # clojure-uk (4)
- # clojurescript (56)
- # conjure (5)
- # cursive (24)
- # datalevin (1)
- # datomic (57)
- # fulcro (35)
- # helix (15)
- # holy-lambda (8)
- # introduce-yourself (1)
- # jobs (5)
- # kaocha (1)
- # lsp (99)
- # malli (10)
- # music (1)
- # off-topic (22)
- # pathom (38)
- # podcasts-discuss (10)
- # polylith (10)
- # reitit (1)
- # releases (1)
- # remote-jobs (4)
- # shadow-cljs (18)
- # spacemacs (6)
- # tools-build (22)
- # vim (66)
- # xtdb (22)
what is a good way to implement multiple endpoints? When I call the lambda with the url like https//aws.my-thing/foo
does the foo appear somewhere? I can also make it depend on the headers or content or sth
There are two approaches. 1. One lambda per one endpoint 2. One lambda for multiple endpoints. At Retailic we're using the second approach, where we have an integration between regular ring/muuntaja stack and holy-lambda. But if you don't want to use ring, then just print the event. All the necessary properties are there. To use HL with multiple endpoints specify a proxy+ in template.yml like so:
RetailicFabloApiLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Policies:
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "ec2:CreateNetworkInterface"
- "ec2:DeleteNetworkInterface"
- "ec2:DescribeNetworkInterfaces"
- "ec2:DetachNetworkInterface"
Resource: "*"
- Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "rds-db:connect"
Resource:
- !Ref RDSConnectionIAMARN
VpcConfig:
SecurityGroupIds: !Ref SecurityGroupIds
SubnetIds: !Ref PrivateSubnetIds
Environment:
Variables:
DATABASE_URL: !Ref DatabaseConnectionURL
PUBLIC_URL: !Sub "https://${DomainName}"
FRONTEND_URL: !Ref FrontendURL
FunctionName: !Sub "RetailicFabloApiLambdaFunction-${Environment}"
PackageType: Image
ImageUri: !Ref ImageUri
Events:
HttpProxyEvent:
Type: HttpApi
Properties:
ApiId: !Ref RetailicHttpApi
Path: /{proxy+}
Method: ANY
You need just proxy+ 🙂
cool will check. Btw what is a good way to test without using aws sam? Like the -main function get's called I guess with some payload
You mean unit tests or just making sure it will work on AWS as well?
or like you're looking for something like regular ring server that you can span, kill, restart at any time etc?
This works for me https://github.com/FieryCod/holy-lambda/tree/master/examples/bb/native/aws-interop-v2.example
Don't mean unit tests, but simulating the way aws is calling the program + having it running in the repl @U0510KXTU example seems to do that; Will check it out. For my usecase I just need 1 example input data kinda then build the flesh of my program.