serverless-components / website

:zap: Instantly deploy static website on serverless infrastructure with zero configuration using Serverless Components.
https://serverless.com
Apache License 2.0
155 stars 49 forks source link

Error deploying in ap-southeast-2 region Inaccessible host: `s3-accelerate.amazonaws.com'. #47

Closed charleneleong-ai closed 4 years ago

charleneleong-ai commented 4 years ago

I'm trying to deploy a simple React app in ap-southeast-2 but having trouble accessing the s3 transfer acceleration endpoint.

Additionally, buckets used with Amazon S3 Transfer Acceleration can't have dots (.) in their names according to these docs https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html where by default, my bucket name has period because I am trying to declare a domain.

Is it possible to turn off S3 Transfer Acceleration? Not sure if others are having this issue.

Also

➜ sls deploy --debug   
Initializing...
Action: "deploy" - Stage: "dev" - App: "reactapp-sls-components" - Instance: "reactapp-sls-components"
Deploying...
...
Deploying Website
Configuring bucket for hosting
Uploading Website files
 UnknownEndpoint: Inaccessible host: `s3-accelerate.amazonaws.com'. This service may not be available in the `ap-southeast-2' region.
    at Request.ENOTFOUND_ERROR (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:495:46)
    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)
    at ClientRequest.error (/var/runtime/node_modules/aws-sdk/lib/event_listeners.js:333:22)
    at ClientRequest.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/http/node.js:96:19)
    at ClientRequest.emit (events.js:311:20)
    at ClientRequest.EventEmitter.emit (domain.js:482:12)
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:311:20)

4s › reactapp-sls-components › Inaccessible host: `s3-accelerate.amazonaws.com'. This service may not be available in the `ap-southeast-2' region.
eahefnawy commented 4 years ago

Interesting! Thanks for reporting. That makes sense. So folks might not want acceleration because:

  1. Their desired region does not support it
  2. Their bucket name does not support it

I think it would be helpful to have an accelerated: false option with the default being true.

eahefnawy commented 4 years ago

I've fixed it here: https://github.com/serverless-components/website/pull/48

You could try it out on your end by specifying the dev version in servelress.yml

component: website@dev
name: my-website
charleneleong-ai commented 4 years ago

Thanks! It works fine with @dev, however it seems to not be hosting my resources specifically but the a simple Hello Serverless HTML page.

Is this configuration correct ?


name: reactapp-sls-components
stage: prod

component: website@dev
inputs:
  code:
    # root: ./
    src: dist
    hook: npm run build
    # dist: ./dist
  bucketName: charlene-reactapp-sls-components.com
  domain: charlene-reactapp-sls-components.com         # (optional) domain name. this could also be a subdomain.
  region: ap-southeast-2
eahefnawy commented 4 years ago

replace code with src

component: website@dev
inputs:
  src:
    src: ./
    dist: dist
    hook: npm run build

Sorry for the confusion there. I'm gonna update the docs with this as an example. I've also published 1.0.1 with this fix.