gatsby-uc / gatsby-plugin-s3

Deploy your gatsby site to a S3 bucket.
https://gatsby-plugin-s3.jari.io/
MIT License
210 stars 111 forks source link

Wrong URL in update notification #40

Closed slimandslam closed 5 years ago

slimandslam commented 5 years ago

After doing:

$ npm run deploy

It updates the site and then reports:

Your website is online at:
http://mysite.s3-website-us-east-1.amazonaws.com

That URL is incorrect tho:

It should be (change the dash to a period after "website")

http://mysite.s3-website.us-east-1.amazonaws.com

YoshiWalsh commented 5 years ago

For me it's a dash: http://blog.joshwalsh.me.s3-website-ap-southeast-2.amazonaws.com/

EDIT: A dot works too: http://blog.joshwalsh.me.s3-website.ap-southeast-2.amazonaws.com/. Is there a reason the dot should be preferred?

slimandslam commented 5 years ago

For best results, your bucket name should not contain periods. Amazon used to let you do that (maybe they still do) but it will break certain things, and it is definitely not DNS-compliant.

YoshiWalsh commented 5 years ago

Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.). Bucket names can contain lowercase letters, numbers, and hyphens. Each label must start and end with a lowercase letter or a number.

Source

And periods certainly are DNS-compliant. There are very few DNS names that don't have periods in them.

slimandslam commented 5 years ago

What I meant is that is it not DNS convention to use periods within a name. blog.joshwalsh.me is not a single name under DNS conventions, it's a root apex and a 2nd level domain. At the moment, using periods in your bucket name only keeps you from using Amazon S3 Transfer Acceleration, but that could change. Who knows, maybe things will get better?

slimandslam commented 5 years ago

Whether you can use a dash or a period after the word "website" in the S3 website URL appears to depend on the region (maybe some regions handle both?). Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html

YoshiWalsh commented 5 years ago

Very interesting that S3 Transfer Acceleration doesn't work for buckets with . in the name.

You're talking about DNS labels though. A DNS label can't contain any periods, but a DNS name is a list of labels separated by periods. blog.joshwalsh.me absolutely is a single DNS name, and it contains 3 labels.

The docs for bucket names say "The name of the bucket used for Amazon S3 Transfer Acceleration must be DNS-compliant and must not contain periods (".")." (emphasis mine)

YoshiWalsh commented 5 years ago

Good find about the website endpoints. This is crazy. I wonder if there's a way we can get the website endpoint from AWS, or if we just have to use a mapping based on this information.

jariz commented 5 years ago

Related PR: #23

jariz commented 5 years ago

Released in 0.3.0