Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog: lambda + HTTP #146

Merged
merged 7 commits into from
Jul 29, 2024
Merged

Blog: lambda + HTTP #146

merged 7 commits into from
Jul 29, 2024

Conversation

Akeboshiwind
Copy link
Contributor

A blog that attempts to divulge the things I've learnt while trying to call lambda over HTTP recently

Copy link

netlify bot commented Jun 11, 2024

Deploy Preview for juxt-website failed.

Name Link
🔨 Latest commit c6ca5bf
🔍 Latest deploy log https://app.netlify.com/sites/juxt-website/deploys/66a78ffeeb5004000868c74a

4. What happens if an exception is thrown?
5. What other quirks are there?

For the most part I can link you to the relevant part of the docs, but for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swap for 'relevant section' to avoid repetition of 'part' ?

5. What other quirks are there?

For the most part I can link you to the relevant part of the docs, but for
some I needed to run some tests. The tests I ran were:
Copy link
Member

@refset refset Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'but for some questions I needed to run some tests a few experiments'? again to avoid repetition of 'some', but also 'test' has a more specific meaning that you probably don't mean to imply here

'The tests I experiment with were:' (if you want to match up the language)

(See my [last post](https://juxt.pro/blog/plain-clojure-lambda) for how I set
the project up)

Please note that the input is **not** parsed, so any errors that come parsing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'come from parsing'?

| Invalid JSON response | `curl -v -XPOST --data '{}' --header 'Test: invalid' <url under test>` |
| Exception thrown | `curl -v -XPOST --data '{}' --header 'Test: error' <url under test>` |

And the code I used to setup the lambda was:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Clojure code' (for the unfamiliar 🙂 )


Please note that the input is **not** parsed, so any errors that come parsing
the input come from AWS. Also note that the output does not conform to any of
the formats required, this tests how each option behaves in this case.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% clear what this last sentence is saying. input is shown in the code but 'the output', 'the formats', 'each option' and 'this case' all feel slightly ambiguous.

Comment on lines 132 to 133
| Invalid JSON request | `200` | `{}` | The JSON formatted request |
| Invalid JSON response | `200` | `{` | The JSON formatted request |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth calling these out as surprising? (were they surprising to you?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: Maybe it's worth talking about what my initial expectations were in general for all these services?


## API Gateway w/ HTTP API

HTTP APIs are API Gateway's simplest option, which is reflected in it's setup:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider re-phrasing to intro API Gateway a little more (since it's not been mentioned for quite a while by this point), e.g. 'The API Gateway method presents a few options, but using HTTP APIs is the simplest option`

- [Create your HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop.html)
- For **Integrations** select **lambda**
- For **Lambda function** choose your lambda
- See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-regional-api-custom-domain-create.html) setting up a custom domain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'for setting up'?


The [request](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.proxy-format-structure)
and [response](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.v2)
formats seem to be identical to Function URLs, also similarly to Function URLs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'. Also similarly [...]' (full-stop, new sentence)

- Choose **New API** instead of **Example API**
- [Create your Lambda Integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/getting-started-rest-new-console.html#getting-started-rest-new-console-create-integration)
- Keep **Lambda Proxy Integration** turned off (that's the next section)
- See [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-regional-api-custom-domain-create.html) setting up a custom domain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'for setting up'?

@luigiadale luigiadale merged commit 65ab0c8 into main Jul 29, 2024
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants