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

fix(Packaging): Fix support of the artifact S3 uri with region #9411

Merged
merged 3 commits into from May 9, 2021

Conversation

zachwhaley
Copy link
Contributor

#9380 Added support for most S3 bucket URIs, but not ones with region in their format, e.g. any bucket outside of us-east-1.

Closes: #9403

const patterns = [
// S3 URI. Ex: s3://bucket/path/to/artifact.zip
new RegExp('^s3://([^/]+)/(.+)'),
new RegExp('^s3://(?<bucket>[^/]+)/(?<key>.+)'),
Copy link
Contributor

@bishtawi bishtawi Apr 30, 2021

Choose a reason for hiding this comment

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

I didnt realize you could label your matched groups. That is really cool.

// Old style S3 URL. Ex: https://s3.amazonaws.com/bucket/path/to/artifact.zip
new RegExp('s3\\.amazonaws\\.com/([^/]+)/(.+)'),
// Old style S3 URL. Ex: https://s3.REGION.amazonaws.com/bucket/path/to/artifact.zip
new RegExp('s3(\\.[\\w\\d-]+)?\\.amazonaws\\.com/(?<bucket>[^/]+)/(?<key>.+)'),
Copy link
Contributor

@bishtawi bishtawi Apr 30, 2021

Choose a reason for hiding this comment

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

For this regex and the one above, you should probably support urls with dashes separating the s3 from the region as apparently s3-region is a valid url is some aws regions.

Ex: https://my-bucket.s3-us-west-2.amazonaws.com

So ([.-][\\w\\d-]+)?.

@codecov
Copy link

codecov bot commented May 3, 2021

Codecov Report

Merging #9411 (9ab7937) into master (132c830) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9411   +/-   ##
=======================================
  Coverage   86.89%   86.90%           
=======================================
  Files         321      321           
  Lines       11961    11966    +5     
=======================================
+ Hits        10394    10399    +5     
  Misses       1567     1567           
Impacted Files Coverage Δ
lib/plugins/aws/utils/parse-s3-uri.js 100.00% <ø> (ø)
lib/utils/telemetry/anonymize-stacktrace-paths.js 100.00% <0.00%> (ø)
lib/plugins/aws/package/compile/events/httpApi.js 93.48% <0.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 132c830...9ab7937. Read the comment docs.

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

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

Thank you @zachwhaley - it looks great 🙌 Before we merge, it looks like there are minor issues with formatting - could you please take a look at it? After that we should be good to go 🚀

@zachwhaley zachwhaley requested a review from pgrzesik May 6, 2021 17:26
Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

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

Thank you @zachwhaley, looks great 👍

@pgrzesik pgrzesik changed the title Add support for more S3 URI formats fix(Packaging): Fix support of the artifact S3 uri with region May 9, 2021
@pgrzesik pgrzesik merged commit 40e56fc into serverless:master May 9, 2021
@zachwhaley zachwhaley deleted the s3Uri branch September 21, 2022 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support S3 URI format for package artifact
3 participants