GithubHelp home page GithubHelp logo

googlecodelabs / cloud-nodejs Goto Github PK

View Code? Open in Web Editor NEW
43.0 11.0 30.0 39 KB

Build a Node.js Web App using Google Cloud Platform

Home Page: https://codelabs.developers.google.com/codelabs/cloud-nodejs/

License: Apache License 2.0

JavaScript 83.17% CSS 8.47% Pug 8.36%

cloud-nodejs's People

Contributors

alexismp avatar fhinkel avatar grant avatar hostirosti avatar joeint avatar mylesborins avatar tswast 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-nodejs's Issues

Nodejs Web app nits

I noticed the following nits as I worked through the Build a Node.js Web app on this page:
https://codelabs.developers.google.com/codelabs/cloud-nodejs/#9

Nit 1.
Under "Set up OAuth 1.0 Client"
"First, you need to create a web application client for authentication."
Shouldn't this be "... create a web application client ID for authentication ...

Nit 2.
You'll need the URL that you've been using to access the app from the browser. That will have the form https://8080-dot-<9 digit number>-dot-devshell.appspot.com/

My URl has an embedded 7-digit number (not 9 digits).

Nit 3.
In the same section, to access the fields referenced in 6, 7, & 8, the user first needs to click the OAuth consent screen tab this should be done before creating the credentials.

Nit 4:

Fix typo: "Next, you will associated users with the books they add and query Datastore for only that user's books." -> "Next, you will associate users ..."

Problems with the Datastore section

In the List All Books page

Query For Entities section
The following step throws an exception:

To view your changes, stop your running node.js web server by pressing CTRL + C and run it again.
node app.js

someuser@my-nodejs-codelab-158721:~/cloud-nodejs/start$ node app.js
Running on http://localhost:8080/
Error: The project my-nodejs-codelab-158721 does not exist or it does not contain an active Cloud Datastore database. Please visit http://console.cloud.google.com to create a project or https://console.cloud.google.com/datastore/setup?project=my-nodejs-codelab-158721 to add a Cloud Datastore database. Note that Cloud Datastore always
has an associated App Engine app and this app must not be disabled.
at Function.GrpcService.decorateError_ (/home/someuser/cloud-nodejs/start/node_modules/gcloud/lib/common/grpc-service.js:482:34)
at Object.callback (/home/someuser/cloud-nodejs/start/node_modules/gcloud/lib/common/grpc-service.js:247:35)
at /home/someuser/cloud-nodejs/start/node_modules/grpc/src/node/src/client.js:420:14

Create Entity using the Developers Console section
Step 2. Kind: Select Book from the dropdown
Dropdown is empty. No way to select book, need to type it

Step 3. Under the property list, change the value of the title property to A Tale of Two Cities
There are no properties yet. Need to add new properties.

Error: Key is not defined

After creating the first Entity it and try to run the node app according to STEP-6 I get the following error.

Running on http://localhost:8080/
/home/user_name/cloud-nodejs/start/app.js:40
    var keyBooks = books.map((book) => Object.assign(book, { id: book.id || book[key].path[1] }));
                                                                                 ^
ReferenceError: key is not defined
    at books.map (/home/user_name/cloud-nodejs/start/app.js:40:82)
    at Array.map (native)
    at /home/user_name/cloud-nodejs/start/app.js:40:26
    at /home/user_name/cloud-nodejs/start/node_modules/google-cloud/node_modules/@google-cloud/datastore/src/request.js:577:7
.....

Solution:

I works when I change from id = 0 to id = 1 for the entity I created.

Add CI/tests

Due to some recent Datastore updates, some GCP Next participants ran into errors with this lab during the event.

IMHO, we need some way to automatically/periodically test this and other codelabs - to make sure that doesn't happen in the future.

Missing step for creating a datastore in the codelab, "Build a Node.js Web App Using GCP"

In the tutorial, there seems to be a step missing to build a datastore. I'm new to GCP and node.js, so if I missed something obvious, please tell me. By the way, my

There is no dropdown for Books when I follow these steps at https://codelabs.developers.google.com/codelabs/cloud-nodejs/index.html?index=..%2F..%2Findex#6

Create Entity using the Developers Console
To test the Datastore query and see data displayed, add a Book entity from the Google Cloud Console.

  1. Open a new web browser taband visit Google Cloud Console
  2. Select to your Google Cloud Platform project using the dropdown at the top.
  3. From the left navigation menu under "Storage", click Datastore
  4. Click Create Entity

Bug/Typo in Step 9 (Upload of Images)

// AS-IS
In file book.js
var dataset = gcloud.datastore.dataset();

// TO BE
This is the corrected code -
var datastore = gcloud.datastore({
projectId: config.projectId,
keyFilename: config.keyFilename
});

The problem with this code is that datastore.dataset() is an invalid function and the entire dataset variable is not used in the code thereafter. probably got pasted from somewhere 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.