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

Minimal Storage Abstraction #25

Closed
trieloff opened this issue May 18, 2021 · 7 comments · Fixed by #29
Closed

Minimal Storage Abstraction #25

trieloff opened this issue May 18, 2021 · 7 comments · Fixed by #29
Labels
enhancement New feature or request released

Comments

@trieloff
Copy link
Contributor

We have a couple of actions now that need access to S3 or equivalent storage locations. Instead of creating a full-blown storage abstraction, what about starting with a minimal set of:

  • context.storage.presignURL(bucketname: string, path: string, method?: string = 'GET', expires?: number = 60): generates a pre-signed URL for the specified bucket and path. This URL can then be used in a helix-fetch request to upload or download from storage.

For Adobe I/O Runtime we may be able to use https://github.com/adobe/aio-lib-files which has support for pre-signed URLs, but that requires the presence of @adobe/aio-lib-files in the container image.

For all others, there are libraries that can even take the credentials from the container, so we should be covered.

@trieloff trieloff added the enhancement New feature or request label May 18, 2021
@tripodsan
Copy link
Contributor

I don't think this will solve any problems. the idea is that we read from the same storage as the function runs. and those functions can be given the correct policies to read the storage (usually, the session key is in the env).

also, the access to the storages via fetch probably needs more than just an url. e.g. it might require an authorization header.

For Adobe I/O Runtime we...
For Azure we...

not supported :-)

@trieloff
Copy link
Contributor Author

With a pre-signed URL, you really just need the pre-signed URL.

The problem I see is not the authentication, but that the action code itself is no longer universal but needs to conditionally load the AWS or Google client libraries, which blows up the bundle size.

@tripodsan
Copy link
Contributor

action code itself is no longer universal but needs to conditionally load the AWS or Google client libraries, which blows up the bundle size.

I fear that in the future, we will have a bundle for each cloud. otherwise we cannot support ESM modules.

@tripodsan
Copy link
Contributor

@trieloff
Copy link
Contributor Author

And the pre-signing works without an extra HTTP request, so there is no performance impact.

@trieloff
Copy link
Contributor Author

I'm wondering if we should just implement the signing ourselves (again: https://github.com/adobe/helix-pages/blob/prototype-three-fetchpool/assembly/request-signer.ts) so that we can sidestep the dependency issue entirely.

trieloff added a commit that referenced this issue May 20, 2021
github-actions bot pushed a commit that referenced this issue May 27, 2021
# [1.6.0](v1.5.1...v1.6.0) (2021-05-27)

### Bug Fixes

* **aws:** use correct operation names ([177f303](177f303))

### Features

* **aws:** add storage api ([a078cac](a078cac)), closes [#25](#25)
* **google:** add google storage api ([da3234d](da3234d))
* **google:** expose storage api in context for google ([e5fc7dd](e5fc7dd)), closes [#25](#25)
@github-actions
Copy link

🎉 This issue has been resolved in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants