By Developers, For Developers

Historical errata for Serverless Single Page Apps

PDF PgPaper PgTypeDescriptionFixed onComments
34TYPO

there’s a typo in bash command line to create a S3 bucket, it’s “create_bucket” rather than “create-bucket”

2016-01-07
54SUGGEST

Hi Ben,
Well I read thru Chapter 3 (sorry just bought the book), and I do have 1 suggestion:
I understand you only scratching the surface of Single Page Application, and not sticking to any framework which is cool, and it’s a subject beyond this book. Any developer that actually develops SPA would probably using one of the popular frameworks/libraries like angular/ember/react/etc.. For a developer to develop SPA, he must at least have some good knowledge in JS and jQuery, otherwise it’ll be difficult for a js beginner. So explaining some of the basic js/jquery in many examples/pages are not necessary (ie. jquery.ready()).

So I’d love to see more:

- Real examples of using AWS

- Best Practices

- More explanation of AWS Architecture
- Real examples of using one of the major frameworks if possible (source code on github is ok)

I’m sure you’ll have some of these topics in later chapters, which I’m still reading.

Thanks
Lance

2016-01-07Thanks for the suggestion, Lance. Chapters 4 through 8 provide many examples of AWS architecture and use, and I expect are exactly what you're looking for. \n \nI'm trying to keep the book accessible to people who may have never built a single page app before, so for someone who's more familiar with the topic (as I would assume you are), there's a few parts in Chapters 2 and 3 you might want to skim, rather than read in depth. You may want to take a look at the "reader's goals" outlined in the introduction, and see if any of them match up with what you're trying to get out of this book. That might help direct your attention as you continue.
8viTYPO

third para, last sentence: “complimentary” should be “complementary”.

2016-01-07
13xiTYPO

First sentence of regular text: “that doesn’t mean you can use them” should be “that doesn’t mean you can’t use them”

2016-01-07I think my brain just didn't want to write the double negative.
epubERROR

Script “learnjs/sspa” doesn’t work on paths with embedded spaces. Fix in PR on github

(Chapter 1: Using your workspace)

2016-01-08
14SUGGEST

use relative image link without the leading slash, so the page can be opened without running a web server (see my pull request for adjusting the script and font paths).

2016-01-10
34TYPO

Argument to sspa script is incorrect. Instead of create-bucket, it should be create_bucket

2016-01-13Already fixed for the next release. Thanks Andrew.
60TYPO

We’ve make (made) it a surprisingly long way through this tutorial without figuring that out.

2016-01-15
61TYPO

If they do that, the answer will (be) judged to be correct

2016-01-15
54ERROR

figure should show

instead of “desc”

2016-01-21
28TYPO

The sentence, “We need to create a view container in the markup, to give the router has a place to add the views.” Was probably supposed to be, “…markup, to give the router a place to add the views.” Or, “…markup, so that the router has a place to add the views.”

2016-01-20
35ERROR

Hash is not added to URL at this point, contrary to text.

First paragraph reads “Clicking the call to action button on the landing page won’t change the view yet, but it will add a hash to the URL shown in the browser,”.

There is nothing in the html or app (yet) to change the location to include the hash when the button is clicked.

2016-01-21
66DEFER

CSS styling ‘text-lg’ (for toolbar text ‘Learn JS’) only displays that way on larger screens. Those of us with smaller screens won’t see that effect as shown on the image on page 68. I think that’s worth as much mention as the “user-select” discussion of vendor prefixes.

2016-02-09I originally had a whole chapter on responsive design, but I took it out because the book was losing focus. I might bring it back as a new section in chapter 3 if we do a second edition. For now, I'll see if I can make some tweaks to that styling to make it more responsive.
xiTYPO

The first sentence of paragraph Goal #3 goes:

“As I’ve already mentioned, I didn’t want this book to focus on web frameworks, but that doesn’t mean you can use them to build serverless single page apps.”

I think it should be “… doesn’t mean you CAN’T use them…”

2016-01-21
4TYPO

“… but a well-supported use case of thier tools and infrastructure.”

Should be THEIR.

2016-01-21
6TYPO

“The application server may not be able to manage identity at an application level like AN serverless app can.”

Should be “A”.

2016-01-21
7TYPO

“While AN serverless architecture”

2016-01-22
9TYPO

Last paragraph: “How can we deploy our app if we haven’t BUILD it yet?”

Should be BUILT.

2016-01-22
103ERROR

The code listing for appOnReady does not include the line…

learnjs.identity.done(learnjs.addProfileLink);

Also, I had to add signin-bar to my div. I don’t recall that being mentioned anywhere in the text, unless I missed it somehow.

2016-02-04
103ERROR

There is no mention of how to add the profile link in the HTML. I added the following…

And then I added the signin-bar class to the ul element that contains the other links. I also changed the JS code to append the link so it goes on the end.

2016-02-04
122ERROR

You forgot to mention that you have to pull the definition of answer out to the parent method so it’s val() can be accessed in the checkAnswerClick() method. I saw it in your source code, but not in the book.

var answer = view.find(‘.answer’);

2016-02-04
2711TYPO

For now, the only thing in this file is a custom subset of the JavaScript library for Amazon Web Services 3 (verion 2.2.4) with the following service libraries:

version is missing the letter ‘s’

2016-02-04
19ERROR

running create_bucket failed because credentials could not be found. changing the aws credentials file so that the profile was set to [default] rather than [admin] fixed the problem for me

2016-02-04The "Creating an AWS User With Access Keys" section in chapter one describes how to create an admin profile. Keeping this profile separate from the default profile has many benefits because it is a superuser and can do basically anything to your AWS account. As the example shows, be sure to add the `--profile admin` option when running `aws configure`
xiTYPO

“you can have confidence that the techniques in this book as advertised” -> “you can have confidence that the techniques in this book work as advertised”

2016-02-12
12SUGGEST

Running `./sspa server` at this point exits with an error code and the message:

```
The config profile (admin) could not be found
Run `aws configure —profile admin` to create it
```

But the reader hasn’t been told how to do this yet. Checking for aws-cli tools and profiles probably isn’t necessary at this stage or to use the development server in general.

2016-02-12This should be fixed in the newest version of the prepared workspace. You can pull updates from either the beta3 or master branch to resolve this issue.
78ERROR

This command fails!

./sspa create_pool conf/cognito/identity_pools/learnjs
Creating identity pool: learnjs
./sspa: line 126: support/jsed.py: No such file or directory
./sspa: line 127: support/jsed.py: No such file or directory
Creaing role: _cognito_authenticated
./sspa: line 158: support/jsed.py: No such file or directory
./sspa: line 159: support/jsed.py: No such file or directory
Updating identity pool roles
usage: aws [options] [ …] [parameters]
To see help text, you can run:

aws help
aws help
aws help
aws: error: argument —identity-pool-id: expected one argument

2016-05-05The jsed script should be in the prepared workspace, here: \n \nhttps://github.com/benrady/learnjs/blob/beta3/support/jsed.py \n \nDo you see it in your copy of the workspace? \n \n(I'm marking this fixed for now. If updating to the latest version of the prepared workspace doesn't fix the issue, feel free to open a new one)
26TYPO

Heading “Learning by Doing”, last sentence reads “you can have confidence that the techniques in this book as advertised.” Suggest should end “work as advertised”.

2016-02-16
31OK

I needed to change to point to the images subdirectory, not from the root directory.

Updated to be for the image to render in the page.

I’m using the ‘sspa’ server for reference.

2016-02-22
31SUGGEST

Ignore my previous bug report, #79979.

I realized that the issue was with the Live Preview in the editor. I can’t find a way to cancel a bug report, so issuing this “suggestion” to ignore it. :-)

2016-02-22
90TYPO

Replace “Asyncronous” with “Asynchronous” in the purple box title.

2016-03-02
allERROR

The code examples are all malformatted in .mobi version of the book. All the initial spaces are missing. For context I am using the latest (4.18) version of the iOS Kindle App.

2016-04-07
3TYPO

The mobi format of the eBook appears to have a shifted sequence of images. If the sequence of images can be likened to an array then it’s as if the PDF version properly starts at images[0] but the mobi version starts at images[9].

For example, the PDF displays a light bulb icon in the “This book is about web services, not web frameworks” call-out on page xiv. However, the mobi version shows a very tiny rendition of the AWS S3 policy listing found on page 19 of the PDF. Moving onward, the “N-Tier Design” diagram found on page 3 of the PDF is replaced in the mobi version by the second routing diagram as found on page 28 of the PDF.

2016-04-07
3TYPO

Regarding erratum #80138, I forgot to mention my device is a Kindle Paperwhite, firmware version “Kindle 5.7.2.1”. Sorry for not mentioning this in the original posting.

2016-04-07
24TYPO

In the first paragraph following the heading “Designing a Testable Router”, third sentence, the world “to” is probably needed:

“If we want to create a fast feedback loop that tells us if things are working, we’re going to need [to] diverge from the traditional approach of running a complete service stack in a development environment in order to test the application while we build it.”

2016-04-07
17TYPO

First paragraph, second full sentence: “it’s” should be “its”:

“Segmenting access like this can limit the exposure of compromised keys, prevent test data from making —it’s— [its] way into a production database, or prevent one application from accidentally interfering with another.”

2016-04-07
8TYPO

First paragraph following the “Different Security Model” heading, fourth sentence, an extra “to” exists:

“You have to assume that a malicious user may use the credentials in the browser to try to use —to— any web service that the credentials allow them to access.”

2016-04-07
25TYPO

Last sentence, perhaps “this” should be “the”:

“Also, just like —this— [the] rest of the application, using the LivePage plugin or a LiveReload server means this page will automatically reload as you make changes to the app or tests.”

2016-04-07
44TYPO

Third sentence after the “Deploy Again” heading, missing the word “go”:

“So [go] ahead and deploy the app using the same ./sspa deploy_bucket command we used in chapter 1.”

2016-04-07
15TYPO

Last line of the Page it should be “your own automated expert”. The “y” was missing.
Introduction XV

2016-04-07
287TYPO

Beginning of second paragraph an “are” is missing:
“As you can see, there ‘are’ a lot of reasons”

2016-04-07
4019SUGGEST

Mention, that in the sspa script only us-east-1 is supported and not europe (Neither Ireland nor Frankfurt) s3 bucket creation.
Otherwise people will spend hours trying to find their faults even though it is not their own fault.

2016-04-14
4120SUGGEST

It would be great, if there (maybe in the appendix) is a common errors an dhow to solve them part.
Possible entries:
Problems with sspa
Deployment worked but why can’t I access the endpoint

2016-04-14
2747TYPO

There is an “is” missing in the second sentence after the test description picture. It should be:
“The router function’s job ‘is’ to find and display”

2016-04-07
3959TYPO

Last line of the blue Fire-Y Box type: ‘to confidence’ should be ‘the confidence’.

2016-04-07
3959TYPO

Blue Fire-Y Box last line should probably be ‘in the blink of an eye’ instead of ‘a blink of an eye’.

2016-04-07
56ERROR

In the code sample at the bottom of page 56, I believe:

code: learnjs.formatCode(problem),

should actually be:

code: learnjs.formatCode(problem.code),

The reason is because the copy goes on to say “You just need to change formatCode to take one of the problem objects instead of just the text…”.

2016-04-14
128TYPO

Screenshot shows wrong policy - s/b AmazonDynamoDBFullAccess

2016-04-14
6141TYPO

After the markup block in the first sentence a ‘does’ is missing in: ‘It’s very important that our markup div “does” not include the script tag’

2016-04-07
4464TYPO

In the Deploy again part the second sentence is probably meant to start with ‘Go ahead’ instead of ‘So ahead’.

2016-04-07
4464TYPO

In the Deploy again part the third sentence is probably meant to start with ‘Go ahead’ instead of ‘So ahead’.

2016-04-07
6444TYPO

Last sentence of Deploy Again part. An ‘a’ is missing:
‘bring up the app in a browser and give it “a” quick tour’

2016-04-07
7152TYPO

In the second last paragraph in the last sentence there is a ‘is’ missing and the proposition is mixed up (used ‘of’ instead of ‘for’). it should probably be:
‘This “is” a great example “for” (of) a situation where combining web standards with web services makes things much easier for us.’

2016-04-07
7657TYPO

Last sentence on page: one ‘to’ too much. Remove ‘to’ in brackets:
“and then deploying both changes as an atomic operation by pushing (to) everything to S3”

2016-04-07
8970TYPO

Second paragraph last sentence. there are two typos:
‘This button will only show up when (with) the problem view is loaded, and it will be removed when the problem view is removed.’

2016-04-07
102TYPO

Second paragraph, third line, ‘By using the Congito identity ID’ is probably Cognito.

2016-05-02
3556OK

Some of the locations in the provided code contain the string “6000”. For example, in the lambda section, the book tells me to open the file:

learnjs/6000/services/package.json

Not sure where the 6000 comes from (I’ve seen it before).

Oh, my PDF page number is location 3556 of 5077 in the kindle version of the book.

2016-05-02 \nEach "version" of the code in the book has its own number. Files like index.html and app.js are changed over and over again, and so those numbers are in the path to distinguish them. They roughly correlate to chapter numbers. \n \nWhen the book is finally published (along with the code samples), you'll have access to all the versions.
6281TYPO

1st Paragraph “when it’s actually checking the answer ever time.”

Should be “every” time

2016-05-17
117TYPO

Chapter 6: “While running every line code needed”. Should probably say every line of code

2016-05-17
103SUGGEST

“In the developer console for our application, you should see the callback arguments logged out”.
It’s a nitpick, but as this is in the context of identity/authn I’d suggest saying “logged to the console” rather than logged out

2016-05-17
27TYPO

The following sentence from page 27 is missing a verb. “The router function’s job to find and display the appropriate view, given the current route as defined by the URL’s hash.”

2016-06-03
33OK

following code
$(‘.view-container’).empty().append(viewFn());
causing test runner failure “TypeError: viewFn is not a function”
probably it should be $(‘.view-container’).empty().append(viewFn);

2016-07-13You definitely want to invoke the viewFn and append the result, rather than trying to append the function itself. I would double check that you've defined viewFn correctly.
48ERROR

In the code samples starting with brapps/code/learnjs/3000/public/index.html, there is one

statements at the end of the head section. So, think it’s cosmetic and ignored, but present in all the chapter 3 code samples from then on.

48SUGGEST

Minor, but the SpecHelper.js being mentioned contains a loadFixture function which accepts a “path” parameter. The parameter is not being used inside the function though. Instead there is a hardcoded path (‘/index.html’). Since it’s a SPA that path never has to change I guess, so the function signature could be changed to not accept any parameters.

86OK

“Also, note the use of jQuery’s bind function to attach an event listener to the view element.”

jQuery’s “bind” is deprecated, so it would be better to replace it with “on”.

2016-09-26.bind() is deprecated in jQuery 3.0. This book uses jQuery 2.x. Feel free to use .on() instead of you want to upgrade.
35ERROR

After adding the spyOn function to the app_spec.js file and re-deploying the app, the Jasmine test framework reports “No specs found”. I’m using ver 2.3.4 of the Jasmine framework…could that be the problem?

2016-10-03
35SUGGEST

This is a retraction of my previous erratum report…I found that I had neglected to close a string in a parameter to the “expect” function of the spyOn block. After closing the string with a trailing tick-mark, everything is working again. Sorry for the bad erratum report!

2016-10-03
76ERROR

Executing the ./sspa create_pool command creates a pool, but not the role name. This is due to an error in the “assume_role_policy.json” file. Manually executing the aws script in function “create_cognito_auth_role” in the sspa script causes aws to report an error that the “…policy contains invalid Json”. Changing the open-bracket “[” following the “Statement” on line 3 of the assume_role_policy.json file to an open-brace “{” (and the corresponding “]” to “}” on the next-to-last line) fixes the problem, and the sspa script runs to completion without error, as evidenced by a correctly-formatted role_info.json result file.

48ERROR

I don’t think the tests were updated after the changes to learns.problem view. Text no longer equals ‘Problem #1 Coming Soon!’

121ERROR

When I was trying to create the lambda functions, I did:
​learnjs $ ​​./sspa​​ ​​build_bundle​
​learnjs $ ​​./sspa​​ ​​create_service​​ ​​conf/lambda/functions/popularAnswers

and I’m got this issue:
Waiting for IAM Role to become available…Traceback (most recent call last):
File “support/jsed.py”, line 6, in
doc = json.load(json_file)
File “/usr/lib/python2.7/json/init.py”, line 291, in load
**kw)
File “/usr/lib/python2.7/json/init.py”, line 339, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
raise ValueError(“No JSON object could be decoded”)
ValueError: No JSON object could be decoded
…done!
usage: aws [options] [ …] [parameters]
To see help text, you can run:

aws help
aws help
aws help
aws: error: argument —role: expected one argument

I can see the learnjs_lambda_exec in IAM, but looks like there is no lambda created, in AWS Lambda console.
Also there is no test buttom in Testing Functions Through the AWS Console, so I’m not sure if the lambda was actually created.

2017-04-26It's possible the lambda was not created. Can you tell me what your conf/lambda/functions/popularAnswers/config.json file looks like?
121ERROR

Hi Ben, regarding to the problem #81236, I solved it using Runtime: “nodejs4.3”, it is a minor issue, but would be good a review.
Thanks.

2017-04-26Thanks for reporting this. Amazon recently ended support for earlier versions of Nodejs in Lambda. I updated the sspa script in github to reflect this change and use Node version 4.3.
57TYPO

learnjs.applyObject(learnjs.problems[problemNumber 1], view);
- is missing
[problemNumber - 1]

Hmm. I can't seem to find this error. Is this in the learnjs/3200/public/app.js or the learnjs/3300/public/app.js example?
117TYPO

Love the book. In cost calculation you state that a Lambda with 128MB of memory taking which takes 100ms to run and with 100,000 invocations would be 125GBS
Shouldn’t this be 1250GBS? IE: 100,000 * 0.1 seconds = 10,000 seconds. 10,000 seconds multiplied by 128MB (IE: 1/8th of a GB) =1250 GBS

Yes, you are correct. It would be 1250 GBS, but I believe that is a typo rather than a miscalculation because the price of $0.02 is correct ($0.00001667 * 1250).
53ERROR

1. Subject:
Source Code does not run correctly

2. File Name:
code/learnjs/3200/public/index.html

3. Downloaded from:
~~brapps

4.Description in detail:

(1) In the chapter 2 (p. 53), my code does not show the page (“Problem #1 What is truth? function problem() { return ; }”).

(2) To detect my error on the code, downloaded the source code from the Pragmatic Bookshelf (URL is stated above).

(3) Opened up the source code and ran the html file (code/learnjs/3200/public/index.html).

(4) Then clicked the “Start Now” button, nothing happened except for the URL + #problem-1.

[before to click the button] learnjs/3200/public/index.html
[after clicking the button] learnjs/3200/public/index.html#problem-1

(5) Your book suggested that the browser would show the view as “Problem #1 What is truth? function problem() { return ; }”. But in fact, the page did not change the view at all.

(6) I did not know why the source code (sample code) did not run correctly. I would like to know where the error is to fix my error.

Issue comes from: code/learnjs/3200/public/index.html ?
or from: code/learnjs/3200/public/app.js??

Kind regards

64SUGGEST

The style for class=‘text-lg’ is only provided in the downloads, without which the screenshot on page 66 doesn’t match.

Categories: