Coder Social home page Coder Social logo

serverless-client-s3's Introduction

DEPRECATION NOTICE: The NPM package of this project is not compatiable with v1.0+ of the Serverless Framework. Please use serverless-finch for an updated fork of this project.

serverless-client-s3

serverless gitter version downloads dependencies license

A Serverless plugin that deploys a web client for your Serverless project to an S3 bucket, and make it publicaly available in seconds.

First, install:

npm install --save serverless-client-s3

Second, update serverless.yml by adding the following:

plugins:
  - serverless-client-s3
 custom:
   client:
     bucketName: serverless-client-bucketname
  • Warning: The plugin will overwrite any data you have in the bucket name you set above if it already exists.

Third, Create a client/dist folder in the root directory of your Serverless project. This is where your distribution-ready website should live. It is recommended to have a client/src where you'll be developing your website, and a build script that outputs to client/dist. The plugin simply expects and uploads the entire client/dist folder to S3, configure the bucket to host the website, and make it publicly available.

Or just copy/run the following commands in the root directory of your Serverless project to get a quick sample website for deployment:

mkdir -p client/dist
touch client/dist/index.html
touch client/dist/error.html
echo "Go Serverless" >> client/dist/index.html
echo "error page" >> client/dist/error.html

Fourth, run the plugin, and visit your new website!

serverless client deploy [--stage $STAGE] [--region $REGION]

Fifth, Have fun!

serverless-client-s3's People

Contributors

alexdebrie avatar ar90n avatar austencollins avatar bergkampsliew avatar berndwessels avatar eahefnawy avatar keremtiryaki avatar kevzettler avatar nikordaris avatar pmuens avatar rattrayalex avatar s0enke avatar timheckel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-client-s3's Issues

Deploying To Multiple Buckets

I'm using Route 53, and in order to be able to have people hit www.website.com and website.com I need two buckets.

It would be nice so specify a comma separated list of buckets to deploy to. What do you guys think?

Multiple stages will throw error when runing sls client deploy without -s

When having multiple stages, and running:

sls client deploy 

this error is thrown:

bofur:customername_ncp_projectname username$ npm install serverless-client-s3 -save-dev
bofur:customername_ncp_projectname username$ sls client deploy
/Users/username/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

TypeError: stages[i].getName is not a function
  at ClientDeploy.cliPromptSelectStage (/Users/username/.node/lib/node_modules/serverless/lib/Plugin.js:143:28)
  at ClientDeploy._prompt (/Users/username/Code/customername_ncp_projectname/node_modules/serverless-client-s3/index.js:72:20)
  at ClientDeploy.clientDeploy (/Users/username/Code/customername_ncp_projectname/node_modules/serverless-client-s3/index.js:47:20)
From previous event:
  at /Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:186:31
  at Array.reduce (native)
  at /Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:185:32
From previous event:
  at Serverless._execute (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:183:12)
  at Serverless.actions.(anonymous function) (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:429:20)
  at Serverless.command (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:398:38)
  at /Users/username/.node/lib/node_modules/serverless/bin/serverless:19:16
  at processImmediate [as _immediateCallback] (timers.js:384:17)
From previous event:
  at Object.<anonymous> (/Users/username/.node/lib/node_modules/serverless/bin/serverless:18:4)
  at Module._compile (module.js:399:26)
  at Object.Module._extensions..js (module.js:406:10)
  at Module.load (module.js:345:32)
  at Function.Module._load (module.js:302:12)
  at Function.Module.runMain (module.js:431:10)
  at startup (node.js:141:18)
  at node.js:977:3

When running:

sls client deploy -s name-of-stage

it works just fine.

Suggested behavior:
show of list of stages and let the user choose which one to deploy to like:

sls dash deploy 

does.

Can I setting s3 buckets policy locally?

Dear serverless-team.

S3 buckets policy setting is fixed in index.js.
Therefore,we always change to s3 buckets policy at deploy time.
We would like to setting to s3 buckets policy in local serverless project.
Do you have any ideas?

let policy = {
Version: "2008-10-17",
Id: "Policy1392681112290",
Statement: [
{
Sid: "Stmt1392681101677",
Effect: "Allow",
Principal: {
AWS: "_"
},
Action: "s3:GetObject",
Resource: "arn:aws:s3:::" + this.bucketName + '/'
}
]
};

Thanks.

Changing s3 bucket

Hi serverless team,

Is there a way to configure the serverless deployment to a different s3 bucket?

Deploying an ES6 React Static Site to S3 -- Requirements and Lessons Learned

Nice work on this project, guys! 👍

My serverless front-end is a ReactJS ES6 Static S3 site. I've learned a number of things along the way that might be of value:

1) Static Site Boilerplate
Check out React Static Boilerplate. This is the most robust boilerplate for an S3 static site I’ve found so far. While its webpack is a bit complicated to digest at first, the architecture of the project is well done. Additional points:

• Supports hot-loader for debugging
• Supports browser sync for multi-device debugging
• Multi-page router support
• Uses a static directory for assets (convenient)
• Bundles and compresses very nicely for a single directory simple S3 deployment

2) Deployment to a pre-existing named buckets is important
Not sure if I misunderstood the conversation, but I think I read that buckets would conform to a serverless naming convention. That won't work when Route 53 binds the domain to the bucket. Further, if everything is configured already, you don't want to rebuild but rather update with overwrite or ignore, depending upon the file / directory. If I misunderstood the conversation on this topic, then please disregard this point.

3) Metadata and zero-length files are required for scaling and working around an Android SMS link bug
Real-world static websites often require parameters to be passed via hash or query strings. However, many Android devices truncate hash and query strings from the urls sent via SMS, which means you must use subdirectory/sub-path redirect to re-populate the hash and query strings (much like bit.ly). Additionally, if an SPA has pseudo-pages such as a blog (like the boilerplate, above), there will likely be a need for redirects as the site matures.

It would be of value to have something like the json below to create zero-length file redirects, and set metadata on other file copied:

“filename” :  {
    “metadata” : {
        “redirect” : “http://domain.com?param=1”,
        “expires” : “time”,
        ...
    },
    “content” : “hello world”  (optional)
}

NOTE: You could also use API Gateway + Lambda to return a dynamically generated html string that passes though on GET, but then the entire execution environment must fire up increasing latency and cost. At this point S3 redirect seems more appealing.

Thoughts?

Terminal Error (The specified bucket does not exist) after "serverless remove"

I ran into a terminal error with serverless deploy. If you attempt to serverless remove an s3 bucket that has a file in it, you get the following error:

An error occurred: s3 - The bucket you tried to delete is not empty.

I have seen other issues listing the same thing, so this seems to be known. However, if you then attempt to either serverless deploy or serverless remove, you get the following error:

The specified bucket does not exist

I have seen other issues list the same error message if the user manually deletes the severless s3 bucket, however, that is not the case here, serverless seems to be causing the issue. The only way I can correct this is if I change the service name in the serverless.yml file.

Wish: more complete example

It would nice to be able to a single serverless command to deploy static content to S3, dynamic content to Lambda, and update an AWS API Gateway to route traffic accordingly.

I get the sense this plugin could help with that, but a more complete example would be helpful.

This issue is related: can static pages be stored as lambdas?

tutorial from scratch to deployment

hi,

i m not clear what template i should use installing serverless and serverless-client-s3..

it would be great to have some simple tutorial on how to get from scratch to a S3 deployment of a static site.

cheers!

Enhancement: Manage Cloudfront distributions for client code

Hi there,

Back in the days of JAWS, there was an interesting plugin: https://github.com/boushley/awsm-cloudfront

Basically, it would set up a Cloudfront distribution with two origins, one for static client code on S3 and another with the serverless API Gateway endpoints (using a base-path, like /api/). It would then be trivial to redirect to the distribution URL via Route 53 or others.

This might be a job for a separate plugin that has serverless-client-s3 as a dependency and also sets up the serverless API part.

I thought I'd bring it up here :)

Serverless plugin "serverless-client-s3" not found

I've installed serverless-client-s3 as per the readme with npm i --save serverless-client-s3 and listed it under my plugins in serverless.yml. I run sls client deploy and see a message indicating that the plugin has not been found. I'm using Node v6.11.2 and Serverless v1.20.2. Any help would be very much appreciated!

Any plans to support the new version of serverless anytime soon?

Hello, thank you for the plugin. 😃 I am wondering if you have any plans to support the new version of serverless anytime soon? I am currently using Serverless 1.3 and get the following error when try to run sls client deploy.

TypeError: S.getServerlessPath is not a function
    at new module.exports.S.classes.Plugin._prompt (/Users/Chen/Developer/Repository/GitMax/node_modules/serverless-client-s3/index.js:5:30)
    at PluginManager.addPlugin (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:28:28)
    at /usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:61:12
    at Array.forEach (native)
    at PluginManager.loadPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:58:13)
    at PluginManager.loadServicePlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:86:10)
    at PluginManager.loadAllPlugins (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:54:10)
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:64:28
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
 
     Please report this error. We think it might be a bug.
 
  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       4.6.2
     Serverless Version: 1.3.0

Here is the plugin section of the serverless.yml file

plugins:
  - serverless-client-s3

custom:
  client:
    bucketName: my.bucket.name

client path issues

After deployment, all the files are directly copied to bucket root and no folder structure made it. This breaks the index.html paths. Can we deploy the same folder structure directly to bucket?

InvalidBucketName: The specified bucket is not valid

I'm trying to deploy using environment variables:
{
"name": "aaaa_bbbb_cccc",
"plugins": [
"serverless-client-s3"
],
"custom": {
"client": {
"bucketName": "aaaa_bbbb_cccc.${stage}.${region}"
}
}
}

This is what I get when I run the deploy, I'm guessing that the problem is that ${stage} and region doesn't get converted correctly?

Serverless: Deploying client to stage "development" in region "eu-west-1"...
Serverless: / /Users/username/.node/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:49
fn = function () { throw arg; };
^

InvalidBucketName: The specified bucket is not valid.
at Request.extractError (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/services/s3.js:334:35)
at Request.callListeners (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:596:14)
at Request.transition (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:21:10)
at AcceptorStateMachine.runTo (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:37:9)
at Request. (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:598:12)
at Request.callListeners (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Request.emit (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:596:14)
at Request.transition (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:21:10)
at AcceptorStateMachine.runTo (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:37:9)
at Request. (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:598:12)
at Request.callListeners (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at callNextListener (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
at IncomingMessage.onEnd (/Users/username/.node/lib/node_modules/serverless/node_modules/aws-sdk/lib/event_listeners.js:209:11)
at emitNone (events.js:73:20)
at IncomingMessage.emit (events.js:167:7)
From previous event:
at ServerlessProviderAws.request (/Users/username/.node/lib/node_modules/serverless/lib/ProviderAws.js:65:14)
at ClientDeploy. (/Users/username/Code/aaaa_bbbb_cccc/node_modules/serverless-client-s3/index.js:185:28)
From previous event:
at ClientDeploy._processDeployment (/Users/username/Code/aaaa_bbbb_cccc/node_modules/serverless-client-s3/index.js:178:10)
From previous event:
at ClientDeploy.clientDeploy (/Users/username/Code/aaaa_bbbb_cccc/node_modules/serverless-client-s3/index.js:50:10)
From previous event:
at /Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:181:31
at Array.reduce (native)
at /Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:180:32
From previous event:
at Serverless._execute (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:178:12)
at Serverless.actions.(anonymous function) (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:424:20)
at Serverless.command (/Users/username/.node/lib/node_modules/serverless/lib/Serverless.js:393:38)
at /Users/username/.node/lib/node_modules/serverless/bin/serverless:19:16
at processImmediate as _immediateCallback
From previous event:
at Object. (/Users/username/.node/lib/node_modules/serverless/bin/serverless:18:4)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Function.Module.runMain (module.js:431:10)
at startup (node.js:141:18)
at node.js:977:3

S3 Path issue

I had an asset folder with some other folders like css , img , etc. in it. When I deployed it created the asset folder in my S3 bucket but all the underlying folders were not created instead the files in them were named like css\example.css , img\example.jpg . I checked the code and it seems the line # 205 has a replace statement which is not covering the all occurrences of '' :

205: fileKey = filePath.replace(_this.clientPath, '').substr(1).replace('\', '/');

	should be : 

205: fileKey = filePath.replace(_this.clientPath, '').substr(1).replace(/\\/g, '/');

Deploying to new stage

Everything was working great on dev stage. Then I created and deployed my sls functions and endpoints to a new stage. When I went to deploy client, this is what I got:

➜  audible git:(master) sls client deploy
/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:49
        fn = function () { throw arg; };
                           ^

TypeError: stages[i].getName is not a function

Initial Architecture

  • Looks for a client folder in the project root and a s-client-s3.json file in that folder or one level of subfolders.
  • The s-client-s3.json file contains configuration for the website. For example, the website bucket.
  • You should be able to specify file or folder paths of all assets you'd like to be uploaded.
  • Creates or updates the website S3 bucket before upload
  • Should overwrite any assets in S3 by default on upload. There should also be an option to only upload assets that do not exist.
  • Use the following key structure: clientName/js/, clientName/css/, etc.
  • Specify a build script to run. If set, this should run before upload.

Sample s-client-s3.json file:

{
   "name" : ""    // Name of client.  E.g., "dashboard", "admin"
   "cloudfrontDistributionId": null,
   "build" : "path/build.js" // Optional path and file to a build script
}

plugin breaks sls functions

after adding plugin to serverless project, sls and deploy break.

$sls --help
/Users/***/Projects/scrap/serverless/sandbox/node_modules/serverless-client-s3/index.js:5
    SError       = require(S.getServerlessPath('Error')),
                             ^

TypeError: S.getServerlessPath is not a function
    at module.exports.S.classes.Plugin._prompt (/Users/***/Projects/scrap/serverless/sandbox/node_modules/serverless-client-s3/index.js:5:30)
    at Serverless._loadPlugins (/usr/local/lib/node_modules/serverless/lib/Serverless.js:251:25)
    at new Serverless (/usr/local/lib/node_modules/serverless/lib/Serverless.js:82:37)
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/bin/serverless:11:19)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:139:18)
    at node.js:999:3

Feature request: Specify source (dist) folder in config

I'm using both serverless-client-s3 and angular-cli. Unfortunately, both depend on a "dist" folder and each type has it's own specific use. To get around this, I forked your repository and changed the "client/dist" folder to "client/build". It's a short term solution (hack) but it's working for me. I'm also willing to add a configuration parameter (to specify the source folder) and then send you a pull request. Does that interest you?

Rename bucket

It would be great if the bucket name is similar to the serverless bucket name where all the serverless files are stored (this way one can directly identify that both buckets belong to one project).

Use of the term 'client' here is a confusing

The description says

"A Serverless plugin that deploys a web client for your Serverless project to an S3 bucket,"

This phrasing makes it sounds like this plugin puts an HTTP user agent ("web client") into an S3 bucket. That doesn't seem to make sense.

My best understanding that this is actually a client of an S3 server That is, it doesn't put a client into S3, rather it is a client deploys static content into an S3 bucket.

If that's right, the description and possibly some other phrasing could stand to updated.

"A Serverless plugin that publishes static content from your Serverless project to an S3 bucket,"

Backslash problem upon client deployment on windows environment

Running "sls client deploy" in windows environment will not properly structure the files of the project. It will not automatically create new folders which I think caused by the "" on the file locations. Please see image below for reference:

windows

The image below is from a deployment in mac environment which worked out just fine.

mac

NoSuchWebsiteConfiguration after sls client deploy

Sometimes when I deploy a static website I get a 404 NoSuchWebsiteConfiguration when browsing the site. When I look at the configuration of the bucket it has The "Do not enable website hosting" checkbox ticked.
So I think that the "_this.aws.request('S3', 'putBucketWebsite', params, _this.evt.options.stage, _this.evt.options.region)" fails intermittently. I dont get any error in the terminal.

[Question] Multiple stages & regions deployment

Hello All,

I would like to have multiple s-variables files in my _meta/variables folder, in my web SPA project folder, so that when running sls deploy client command, serverless will deploy my web SPA files into multiple S3 Buckets as defined in .json files under _meta/variables folder. Is it possible to achieve this through having multiple .json files in this folder ?
image

Cheers.

Socket hang up error

Every time i make a deploy i got the following error:

Serverless: Deploying client to stage "dev" in region "us-east-1"...
Serverless: Finishing deployment...
Serverless: Successfully deployed client to: ******.s3-website-us-east-1.amazonaws.com
/usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:61
fn = function () { throw arg; };
^

NetworkingError: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1049:19)
at TLSSocket.g (events.js:260:16)
at emitNone (events.js:72:20)
at TLSSocket.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:913:12)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickDomainCallback (node.js:397:17)
From previous event:
at /usr/local/lib/node_modules/serverless/lib/ProviderAws.js:98:18
at processImmediate as _immediateCallback
From previous event:
at /usr/local/lib/node_modules/serverless/lib/ProviderAws.js:91:10
at doCall (/usr/local/lib/node_modules/serverless/lib/ProviderAws.js:22:9)
at /usr/local/lib/node_modules/serverless/lib/ProviderAws.js:33:14
From previous event:
at persistentRequest (/usr/local/lib/node_modules/serverless/lib/ProviderAws.js:20:12)
at ServerlessProviderAws.request (/usr/local/lib/node_modules/serverless/lib/ProviderAws.js:90:14)
at /Users/antonioalarcon/Sites/campaignmanager-ws/node_modules/serverless-client-s3/index.js:267:26
at FSReqWrap.readFileAfterClose as oncomplete

If someone else makes the deploy it works, same project and same network, and if i try to do it i got that error every time.

Deploy - The bucket you tried to delete is not empty

There is an Error in deploy process (tested on windows 7 machine)

First deploy works fine,
Second deploy produce error
Third deploy works fine.

Serverless: | { [BucketNotEmpty: The bucket you tried to delete is not empty]
cause:
{ [BucketNotEmpty: The bucket you tried to delete is not empty]
message: 'The bucket you tried to delete is not empty',
code: 'BucketNotEmpty',
region: null,
time: Thu Mar 17 2016 10:18:06 GMT+0100 (Střední Evropa (běžný čas)),
requestId: '88F2D132F3993ED3',
extendedRequestId: 'Qp0FN7FQ5PRra1yiWe5cx9Yb4BehKdwUb3VyV5dw+u19YFfQSaUhHIQgAe0XqIBuWki9F75fOeY=',
statusCode: 409,
retryable: false,
retryDelay: 99.55260208807886 },
isOperational: true,
code: 'BucketNotEmpty',
region: null,
time: Thu Mar 17 2016 10:18:06 GMT+0100 (Střední Evropa (běžný čas)),
requestId: '88F2D132F3993ED3',
extendedRequestId: 'Qp0FN7FQ5PRra1yiWe5cx9Yb4BehKdwUb3VyV5dw+u19YFfQSaUhHIQgAe0XqIBuWki9F75fOeY=',
statusCode: 409,
retryable: false,
retryDelay: 99.55260208807886 }

Feature Request: Specifying Error Document and Redirection Rules

In S3 Bucket settings for static website hosting, I can specify an Error Document and Redirection Rules in AWS.
serverless-client-s3 defaults the Error Document to "error.html" if it exists in the dist path.
I am building my site in react and would like to redirect all errors to "index.html" to handle them in my code and support browser history.

As a feature request, I'd like to be able to explicitly configure the index, error document, and redirection rules that get set on S3.

Publicly vs Publically

I was going to do a PR to replace publically for publicly because I didn't find it either here:
http://www.wordreference.com/es/translation.asp?tranword=publically

nor here:

http://www.wordreference.com/es/translation.asp?tranword=publically

so I eventually came up with this:
http://english.stackexchange.com/questions/45136/difference-between-publicly-and-publically?newreg=4d54d0dc2f464e64af6566ab628052f7

So I leave up to you. I, personally find strange "publically".
Sorry @eahefnawy for being too weary!

Deploy - invalid bucket name

Error when deploying:

sls client deploy

Serverless: Deploying client to stage "dev" in region "eu-west-1"...
Serverless: / /usr/local/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:49
        fn = function () { throw arg; };
                           ^

InvalidBucketName: The specified bucket is not valid.
    at Request.extractError (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/services/s3.js:328:35)
    at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:596:14)
    at Request.transition (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:21:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:37:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:598:12)
    at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:596:14)
    at Request.transition (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:21:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:37:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/request.js:598:12)
    at Request.callListeners (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at callNextListener (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/sequential_executor.js:95:12)
    at IncomingMessage.onEnd (/usr/local/lib/node_modules/serverless/node_modules/aws-sdk/lib/event_listeners.js:209:11)
    at emitNone (events.js:85:20)
    at IncomingMessage.emit (events.js:179:7)
From previous event:
    at ServerlessProviderAws.request (/usr/local/lib/node_modules/serverless/lib/ProviderAws.js:65:14)
    at ClientDeploy.<anonymous> (/Users/user/Projects/reasonauth_core/node_modules/serverless-client-s3/index.js:191:28)
From previous event:
    at ClientDeploy._processDeployment (/Users/user/Projects/reasonauth_core/node_modules/serverless-client-s3/index.js:181:10)
From previous event:
    at ClientDeploy.clientDeploy (/Users/user/Projects/reasonauth_core/node_modules/serverless-client-s3/index.js:50:10)
From previous event:
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:181:31
    at Array.reduce (native)
    at /usr/local/lib/node_modules/serverless/lib/Serverless.js:180:32
From previous event:
    at Serverless._execute (/usr/local/lib/node_modules/serverless/lib/Serverless.js:178:12)
    at Serverless.actions.(anonymous function) (/usr/local/lib/node_modules/serverless/lib/Serverless.js:424:20)
    at Serverless.command (/usr/local/lib/node_modules/serverless/lib/Serverless.js:393:38)
    at /usr/local/lib/node_modules/serverless/bin/serverless:19:16
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Object.<anonymous> (/usr/local/lib/node_modules/serverless/bin/serverless:18:4)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:139:18)
    at node.js:999:3

Enhancement request: configuration of bucket and static content folder

It would be great if there were configuration options available.

  • Deployment bucket (default current serverless S3), so we can specify separate buckets and keep the static content isolated from serverless lambda & config backup.
  • Static content path (default remains client/dist), so people can switch to client/www, if that makes more sense for them.

client URL is wrong?

Hello serverless-Team,

after deploying to eu-central-1 using sls client deploy the following message appears:

Serverless: Deploying client to stage "dev" in region "eu-central-1"...  
Serverless: Finishing deployment...  
Serverless: Successfully deployed client to: XXX.s3-website-eu-central-1.amazonaws.com 

My static website is not running on that URL. It runs on XXX.s3-website.eu-central-1.amazonaws.com/. So between website and eu there should be a . instead of a -.
Is this a general bug? Am i doing something wrong?

Is deleting the bucket contents always necessary?

I have a (possibly weird) use case where I am using this plugin to put some static assets into a bucket but also have another event that'll put content in the same bucket on a regular basis as well. Having the bucket contents get deleted anytime I do a sls client deploy doesn't work with that workflow. Is there a way to keep things from being overwritten on each deploy?

client deploy exception

The `client deploy' command has started to go wrong. The error message attached below is now appearing. It had been working fine and there's nothing in the output between the last successful deploy and the failing deploy to suggest anything that is wrong. If I log in to the AWS S3 console then that bucket is completely empty.

Is there any way that I can recover from this?

serverless version is 0.5.5 and client-s3 is 2.0.0

thanks,

dan.


/home/dant/serverless/bookings-beta/node_modules/serverless-client-s3/index.js:242
return stats.isDirectory()
^

TypeError: Cannot read property 'isDirectory' of undefined
at ClientDeploy. (/home/dant/serverless/bookings-beta/node_modules/serverless-client-s3/index.js:242:25)
at wrapper (/home/dant/serverless/bookings-beta/node_modules/serverless-client-s3/node_modules/lodash/lodash.js:4357:19)
at FSReqWrap.oncomplete (fs.js:82:15)

yaml exception with example code in README

In REAMDE.md you suggest to add these line to serverless.yml:

plugins:
  - serverless-client-s3
 custom:
   client:
     bucketName: serverless-client-bucketname

however this seems not to be valid yml. When executing serverless client deploy I get the following YAML exception:

  bad indentation of a mapping entry in "/Users/paolini/notes/serverless.yml" at line 59, column 2:
     custom:
     ^

Events on bucket disappear after deploy

Hi,
I would like to have a lambda that sends a notification to a slack channel when the page is deployed (sls client deploy) but everytime the page is deployed all the events disappear. I'm guessing it's becuase the whole bucket gets deleted and re-created?

image

Does not work with serverless 1.0 beta

Hi, so it seems like npm install serverless defaults to the beta, which is fine (seemed a lot easier to get going based on the docs). Unfortunately I could not get things to work when using this plugin.

I ran into this error:

> $ serverless                                                                 

  Type Error ---------------------------------------------

     S.getServerlessPath is not a function

     For debugging logs, run again after setting SLS_DEBUG env var.

  Get Support --------------------------------------------
     Docs:          v1.docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

With debugging on I confirmed that this is coming from this plugin.

Is this still the recommended way to serve a static page using serverless, or should I try something else.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.