Method reference in Java 8

public class Car { private int maxSpeed; public Car(int maxSpeed) { this.maxSpeed = maxSpeed; } public int getMaxSpeed() { return maxSpeed; } } We can sort a list of cars by, Car carX = new Car(155); Car carY = new Car(140); List<Car> cars = new ArrayList<>(); cars.add(carX); cars.add(carY); cars.sort(Comparator.comparing(Car::getMaxSpeed)); If we see the signature of … Read more

Can you have an async handler in Lambda Python 3.6?

I’ve made Lambda functions before but not in Python. I know in Javascript Lambda supports the handler function being asynchronous, but I get an error if I try it in Python. Here is the code I am trying to test: async def handler(event, context): print(str(event)) return { ‘message’ : ‘OK’ } And this is the … Read more

Webpack and AWS Lambda issue – handler missing on module

I’m using ES6, babel and Webpack 2 to bundle an AWS Lambda. I am then running/testing it using AWS SAM local. I get the following error when I hit the api – Handler ‘handler’ missing on module ‘dist/main’ Here is my webpack.config.js – const path = require(‘path’); module.exports = { entry: ‘./index.js’, output: { path: … Read more

Is it possible to POST to the SQS url using the post body

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html https://sqs.us-east-2.amazonaws.com/123456789012/MyQueue/ ?Action=SendMessage &MessageBody=This+is+a+test+message This works fine, however is it possible to send the payload using the post body? I have an external service sending json payloads in the post body (at a very high throughput). It would be ideal if I can simply feed them the SQS url directly, and avoid having to create … Read more

Possible gcc bug with C++14 polymorphic lambdas?

I’ve found a strange behavior using polymorphic C++14 lambdas (lambdas with auto in their parameters): Snippet 0: #include <iostream> template<typename T> void doLambda(T&& mFn) { std::forward<T>(mFn)(int{0}); } template<typename T> void test(T&& mV) { doLambda([&mV](auto mE) { std::forward<decltype(mV)>(mV); }); } int main() { test(int{0}); return 0; } clang++ 3.5.1: the snippet compiles and runs successfully. g++ … Read more

Why would I get a Forbidden message from AWS API Gateway, even though things are working internally?

I have AWS API gateway setup for a public endpoint with no auth. It connects to a websocket that triggers a Lambda. I was creating connections with Python’s websocket-client lib at https://pypi.org/project/websocket_client/. I noticed that connections would fail ~10% of the time, and get worse as I increased load. I can’t find anywhere that would … Read more