Add Support for ES6/ES7 JavaScript

From @jayair on Mon Apr 10 2017 00:59:18 GMT+0000 (UTC)

Link to chapter - http://serverless-stack.com/chapters/add-support-for-es6-es7-javascript.html

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/22

From @EisenbergEffect on Mon May 29 2017 06:13:50 GMT+0000 (UTC)

Any chance that you could show the same setup but using TypeScript instead?

From @jayair on Mon May 29 2017 10:41:21 GMT+0000 (UTC)

@EisenbergEffect We could, but we might have to create a completely separate TypeScript version of the tutorial. And that makes it a little lower on the priorities.

But we could look into creating a one off chapter just for the TypeScript setup.

From @EisenbergEffect on Mon May 29 2017 17:05:59 GMT+0000 (UTC)

I’d love to see one-off chapter, particularly on setting up TypeScript with the Serverless Stack. I’ve got setups for my front-ends framework but I’m new to the Serverless Stack so I wasn’t sure how to handle that part of it.

On a side note, I really love what you all have done here. Once I see how to get this setup with TS for Serverless, I’ll be using this as a foundation for a new side-project of mine. One difference will be that I’m using Aurelia instead of React, but all the front-end work should translate very easily.

From @EisenbergEffect on Tue May 30 2017 03:53:49 GMT+0000 (UTC)

@jayair I found this: https://github.com/y13i/serverless-ts-example

Does that look like a “correct” configuration that would serve as a substitute for the equivalent Babel implementation?

From @jayair on Tue May 30 2017 13:03:59 GMT+0000 (UTC)

@EisenbergEffect I haven’t seen that before but I’ll need to play around with it. I hope there are some other TS folks that are willing to help out.

From @muescha on Mon Jul 17 2017 14:17:34 GMT+0000 (UTC)

what about the idea to implement a language switch where the user can switch the language flavor for the code samples - then it is easy to add step by step the TypeScript examples inline in the tutorial.

also this can be interesting to have an “easy javascript” vs “functional javascript” version - this addresses the #109 recommendations to use advanced functions for the examples.

or maybe some other languages can be implemented on demand

From @jayair on Tue Jul 18 2017 16:56:24 GMT+0000 (UTC)

@muescha I like the idea of having the sample project repos in multiple languages/setups. It would need some community contributions to get it up and running since I’m not much of a TypeScript user.

From @HyperBrain on Thu Aug 10 2017 13:15:47 GMT+0000 (UTC)

There have been a lot of updates to serverless-webpack recently and v3 is just around the corner now :smile: - a prerelease is already available as serverless-webpack@3.0.0-rc.1. The chapter should be updated (especially the webpack.conf.js part) to use the new automatic entry resolution which makes any manual entry file search obsolete (here: globEntries()).

This is already supported in the current version 2.2.0 of the plugin. See the V3 readme/branch for details, what will change and is improved (includes the v2.2.0 changelog at the bottom too).

From @jayair on Thu Aug 10 2017 23:22:31 GMT+0000 (UTC)

@HyperBrain Thanks for letting us know. v3 looks really good! Congrats!

I’ll push out an update to the tutorial once it’s out because it changes a few things (including webpack invoke).

From @kenbankspeng on Thu Aug 24 2017 16:43:28 GMT+0000 (UTC)

Fantastic resource. Please consider mentioning facebook’s create-react-app.

create-react-app notes-app-api

and for typescript:

create-react-app notes-app-api --scripts-version=react-scripts-ts

From @jayair on Thu Aug 24 2017 18:36:20 GMT+0000 (UTC)

@kenbankspeng Thanks!

Are you referring to these commands while we create the API? I think you mean the frontend React app?

From @kenbankspeng on Thu Aug 24 2017 18:55:55 GMT+0000 (UTC)

I was initially thinking regarding both the API and the front end, but looks like create-react-app has other files added which are really only for a front end app, so may not be appropriate for the API. I just liked how create-react-app hid babel and webpack from me. Maybe a configuration option for typescript then. But beggars can’t be choosers…

From @lbybill on Thu Oct 12 2017 23:34:14 GMT+0000 (UTC)

I need help on: I am using ubuntu 16.04

$ serverless invoke local --function create --path mocks/create-event.json
Serverless: Bundling with Webpack...
Time: 587ms
    Asset  Size  Chunks             Chunk Names
create.js  5 kB       0  [emitted]  create
   [0] ./create.js 2.16 kB {0} [built]
   [1] external "babel-runtime/core-js/json/stringify" 42 bytes {0} [not cacheable]
   [2] external "uuid" 42 bytes {0} [not cacheable]
   [3] external "aws-sdk" 42 bytes {0} [not cacheable]

From @jayair on Fri Oct 13 2017 17:02:45 GMT+0000 (UTC)

@lbybill What’s the issue?

From @lbybill on Fri Oct 13 2017 18:03:36 GMT+0000 (UTC)

@jayair The process stops here. I thought this, “[not cacheable]”, is a error.

From @jayair on Fri Oct 13 2017 18:30:34 GMT+0000 (UTC)

@lbybill Oh no those messages are fine. But it looks like your create function did not print anything out. Have you completed this chapter - https://serverless-stack.com/chapters/add-a-create-note-api.html?

From @lbybill on Fri Oct 13 2017 18:54:30 GMT+0000 (UTC)

@jayair Yes. I followed and finished this chapter.

From @jayair on Fri Oct 13 2017 19:44:35 GMT+0000 (UTC)

@lbybill You can follow the console.log to debug what is going on. We talk about it briefly at the bottom the chapter - https://serverless-stack.com/chapters/add-a-create-note-api.html#common-issues.

From @lbybill on Fri Oct 13 2017 23:01:19 GMT+0000 (UTC)

@jayair I got this error. I am behind a firewall. I setup proxy already.

aws dynamodb scan --table-name notes --region us-east-2 in command line works for me.
I am wondering if sls need proxy too?

{ [TimeoutError: Connection timed out after 120000ms]
  message: 'Connection timed out after 120000ms',
  code: 'TimeoutError',
  time: Fri Oct 13 2017 15:01:17 GMT-0700 (PDT),
  region: 'us-east-2',
  hostname: 'dynamodb.us-east-2.amazonaws.com',
  retryable: true }