Add PRO hooks for new lambda provider by joe4dev · Pull Request #7560 · localstack/localstack · GitHub
Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Add PRO hooks for new lambda provider#7560

Merged
joe4dev merged 8 commits into
masterfrom
lambda-public-layers-v2
Feb 7, 2023
Merged

Add PRO hooks for new lambda provider#7560
joe4dev merged 8 commits into
masterfrom
lambda-public-layers-v2

Conversation

@joe4dev

@joe4dev joe4dev commented Jan 26, 2023

Copy link
Copy Markdown
Member

See https://github.com/localstack/localstack-ext/pull/1322

  • Add hook for inject_layer_fetcher
  • Test layers limits (>5 layers)

@joe4dev joe4dev requested a review from dfangl as a code owner January 26, 2023 16:27
@joe4dev joe4dev temporarily deployed to localstack-ext-tests January 26, 2023 16:27 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jan 26, 2023

Copy link
Copy Markdown

@joe4dev joe4dev temporarily deployed to localstack-ext-tests January 26, 2023 22:01 — with GitHub Actions Inactive
@dominikschubert dominikschubert changed the title Add external layer fetching for new lambda provider Add PRO hooks for new lambda provider Jan 27, 2023
@joe4dev joe4dev temporarily deployed to localstack-ext-tests February 3, 2023 15:21 — with GitHub Actions Inactive
@joe4dev joe4dev force-pushed the lambda-public-layers-v2 branch from 01838a8 to feb88d3 Compare February 4, 2023 16:36
@joe4dev joe4dev temporarily deployed to localstack-ext-tests February 4, 2023 16:37 — with GitHub Actions Inactive

@dfangl dfangl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

self.create_layer_lock = threading.RLock()
self.router = FunctionUrlRouter(ROUTER, self.lambda_service)
self.layer_fetcher = None
lambda_hooks.inject_layer_fetcher.run(self)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Interesting idea letting the hook inject the layer fetcher into the provider. Not sure if I like it, but a valid workaround since hooks cannot return a value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. Maybe, I learn more elegant ways to handle this with function plugins in the future ...

Comment on lines +514 to +517

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am still not 100% happy with this, as IAM should enforce it, but seems fine to leave it for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, maybe better to tackle this in a follow-up ...

Omitted factory-based example in providers due to merge conflict:
`localstack/services/providers.py`

```python
layer_fetcher = get_aws_layer_fetcher_class()
layer_fetcher = get_aws_layer_fetcher_fun()

provider = LambdaProvider(layer_fetcher=layer_fetcher)
lambda_hooks.inject_layer_fetcher.run(provider)

return Service("lambda", listener=AwsApiListener("lambda", provider), lifecycle_hook=provider)
```
Fix `ModuleNotFoundError: No module named 'orjson'`
@joe4dev joe4dev force-pushed the lambda-public-layers-v2 branch from feb88d3 to dab096d Compare February 7, 2023 13:18
@joe4dev joe4dev temporarily deployed to localstack-ext-tests February 7, 2023 13:18 — with GitHub Actions Inactive
@joe4dev joe4dev merged commit 9290f57 into master Feb 7, 2023
@joe4dev joe4dev deleted the lambda-public-layers-v2 branch February 7, 2023 20:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants