GithubHelp home page GithubHelp logo

googlecodelabs / cloud-grpc Goto Github PK

View Code? Open in Web Editor NEW
37.0 14.0 16.0 20 KB

Google Cloud Platform - Building a gRPC service with Node.js Source Repository

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

License: Apache License 2.0

Protocol Buffer 10.99% Go 66.14% JavaScript 22.87%

cloud-grpc's Introduction

Google Cloud Platform - Building a gRPC service with Node.js

This repository contains the source material for the Node.js gRPC codelab released at Google Cloud Platform Events. Access the codelab.

This is not an official Google product

cloud-grpc's People

Contributors

hostirosti avatar markmandel avatar thesandlord 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

Watchers

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

cloud-grpc's Issues

last step client.js failed

hi,

The last client.js you show in the last step has grpc.Credentials in the var client but it didn't work because it must be grpc.credentials. lower case.

Misprints on "Step 1 Overview" page of russian version

There are grammar misprints on page Обзор ("Step 1 Overview" of russian version).

I highlighted them, as well as another typo which is also on this page, but already noted in #10.
image

How these typos could be fixed:
"тоже" -> "то же"
"понадобиться" -> "понадобится"

"node server.js" results in "Error: Cannot add an empty service to a server"

I'm going through this tutorial and have already hit #5 / #6 due to grpc being updated since the tutorial was written. Now I've hit the following issue:

When https://codelabs.developers.google.com/codelabs/cloud-grpc/index.html?index=..%2F..%2Findex#4 instructs you to run "node server.js" for the first time, it doesn't say you should get an error, but you do:

$ node server.js
/Users/<user>/src/cloud-grpc/start/node_modules/grpc/src/node/src/server.js:735
    throw new Error('Cannot add an empty service to a server');
    ^

Error: Cannot add an empty service to a server
    at Server.addService (/Users/<user>/src/cloud-grpc/start/node_modules/grpc/src/node/src/server.js:735:11)
    at Server.addProtoService (/Users/<user>/src/cloud-grpc/start/node_modules/grpc/src/node/src/server.js:786:8)
    at Object.<anonymous> (/Users/<user>/src/cloud-grpc/start/server.js:7:8)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)

It looks like I can ignore this one and keep going through the tutorial, but thought I'd open this so you're aware of this issue too. I think I'll stop here though, and hopefully you can take care of any other updates that are required so users can get through the tutorial smoothly. Thanks!

/cc @MakMukhi

Incorrect statement in server.js

Based on the Proto file, the List service states that it returns a list of books, which when received by the client would be of the format:
{ books: [] }. But the statement in server.js block directly sends the books array to the callback. Hence the client will not receive anything.

It should rather be sent as an object as follows: {books} or {books: books}

The link of the page where the issue is: https://codelabs.developers.google.com/codelabs/cloud-grpc/index.html#4

step 4 (Get the sample) fails for me with the first go run command

I'm running on the cloud shell client. Step 4 says "Now, from the project directory, run the command-line client with no arguments (go run client.go) to view the available commands:". It doesn't say what it means by the "project directory" but assuming that's the top level dir (cloud-grcp) this command fails because there's no client. go in this dir.

I tried running it in the 'start' directory, but that fails with these errors:

marccohen@arched-history-136923:~/cloud-grpc/start$ go run client.go
books/books.pb.go:278: cannot use _BookService_List_Handler (type func(interface {}, context.Context, func(interfa
ce {}) error) (interface {}, error)) as type grpc.methodHandler in field value
books/books.pb.go:282: cannot use _BookService_Insert_Handler (type func(interface {}, context.Context, func(inter
face {}) error) (interface {}, error)) as type grpc.methodHandler in field value
books/books.pb.go:286: cannot use _BookService_Get_Handler (type func(interface {}, context.Context, func(interfac
e {}) error) (interface {}, error)) as type grpc.methodHandler in field value
books/books.pb.go:290: cannot use _BookService_Delete_Handler (type func(interface {}, context.Context, func(inter
face {}) error) (interface {}, error)) as type grpc.methodHandler in field value

Document that Node < 7 is currently required

https://codelabs.developers.google.com/codelabs/cloud-grpc/index.html#2 currently says

To run the sample application, the following dependencies are required:

  • Git
  • Node.js

However, if you have the latest major version of Node, v7, you will hit an error installing the grpc npm package: grpc/grpc#8495 (comment)

GCP cloud shells currently come with Node 6.9 installed, but many users following the codelab from their own machines may have the latest Node installed, like I did. (e.g. Mac Homebrew users who've updated anytime since Node 7 came out will hit this.)

Parse error at line 11: illegal field rule: int32

when issuing command "node server.js" I receive the following error:

Error: Parse error at line 11: illegal field rule: int32
at Parser.ProtoBuf.DotProto.ParserPrototype._parseMessage (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/protobufjs/dist/protobuf.js:1117:31)
at Parser.ProtoBuf.DotProto.ParserPrototype.parse (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/protobufjs/dist/protobuf.js:762:34)
at Function.ProtoBuf.DotProto.Parser.parse (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/protobufjs/dist/protobuf.js:797:39)
at Object.ProtoBuf.loadProto (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/protobufjs/dist/protobuf.js:5128:59)
at Object.ProtoBuf.loadProtoFile (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/protobufjs/dist/protobuf.js:5174:52)
at Object.load (/home/ilsorrisodellagioconda/cloud-grpc/start/node_modules/grpc/index.js:135:26)
at Object.deprecated [as load] (internal/util.js:66:15)
at Object. (/home/ilsorrisodellagioconda/cloud-grpc/start/server.js:3:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

books.pb.go needs to be regenerated

Hey,

We recently updated the grpc code and the protoc generator thereby rendering grpc.SupportPackageIsVersion3 obsolete. This will cause compile-time problems. Regenerating books.pb.go should work.
Under books dir run: protoc -I . books.proto --go_out=plugins=grpc:.

Thanks

Step 4: Get the sample - undefined

After running "go run client.go" as requested, output is:
books/books.pb.go:107: undefined: grpc.SupportPackageIsVersion3

Current dir: "~/cloud-grpc/start"
"go get google.golang.org/grpc" in previous step did not return nothing, assumed ok.

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.