Giter VIP home page Giter VIP logo

googlecloudplatform / nodejs-docs-samples Goto Github PK

View Code? Open in Web Editor NEW
2.8K 170.0 1.9K 77.47 MB

Node.js samples for Google Cloud Platform products.

Home Page: https://cloud.google.com/nodejs

License: Apache License 2.0

JavaScript 96.56% CSS 0.06% HTML 0.66% Shell 1.16% PowerShell 0.04% Dockerfile 0.57% TypeScript 0.50% Pug 0.32% Procfile 0.01% Python 0.11% Makefile 0.01%
nodejs google-cloud sample samples api cloud examples javascript

nodejs-docs-samples's Introduction

Google Cloud Platform logo

Google Cloud Platform Node.js Samples

Node.js samples for Google Cloud Platform products.

See cloud.google.com/nodejs to get up and running with Node.js on Google Cloud Platform.

To browse documentation pages that use the samples found in this repository, visit the Google Cloud Samples page.

Setup

  1. Install Node.js version 14 or greater

  2. Install the Google Cloud CLI (gcloud)

  3. Clone this repository:

     git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
    
  4. Obtain authentication credentials.

    Create local credentials by running the following command and following the oauth2 flow (read more about the command here):

     gcloud auth application-default login
    

    Read more about Google Cloud Platform Authentication.

How to run a sample

  1. Change directory to one of the sample folders, e.g. run/helloworld:

     cd run/helloworld
    
  2. Install the sample's dependencies (see the sample's README for details):

     npm install
    
    • For samples with an available TypeScript variant, compile the TypeScript code:

          npm run build
      
  3. Run the sample:

     npm start [args]...
    

Other sample applications

Bookshelf tutorial app

The Bookshelf app is a sample web app written in Node.js that shows you how to use a variety of Google Cloud Platform features.

View the tutorial or the source code.

Contributing

Contributions welcome! See the Contributing Guide.

nodejs-docs-samples's People

Contributors

alexander-fenster avatar averikitsch avatar bcoe avatar dinesh-crest avatar fhinkel avatar gcf-owl-bot[bot] avatar gericdong avatar gguuss avatar grant avatar grayside avatar irataxy avatar jkwlui avatar jmdobry avatar justinbeckwith avatar kweinmeister avatar mco-gh avatar munkhuushmgl avatar murog avatar nareshqlogic avatar nnegrey avatar noerog avatar pattishin avatar release-please[bot] avatar renovate-bot avatar renovate[bot] avatar shnatsel avatar sita04 avatar sofisl avatar telpirion avatar yoshi-automation 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  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

nodejs-docs-samples's Issues

Error [13] Timed out when starting VMs

I've made several attempts to deploy on app engine and i can't get passed this error.

Beginning teardown of remote build environment (this may take a few seconds). Updating module [default]...|Deleted [https://www.googleapis.com/compute/v1/projects/##################]. Updating module [default]...failed. ERROR: (gcloud.preview.app.deploy) Error Response: [13] Timed out when starting VMs. It's possible that the application code is unhealthy. (0/2 ready, 2 still deploying). My-MacBook-Pro-2:appName-server myMacName$

Typing the above URL into the browser I get this
[{ "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Login Required", "locationType": "header", "location": "Authorization" } ], "code": 401, "message": "Login Required" } }]

Received an error with invalid JSON from Parse: Cannot POST /classes/_User\n

I'm using PFUser-Digits resource to authenticate parse users using Twitter's Digits API.

My parse server is hosted on App Engine with MongoLab database.

I get this error when trying to signup/login

Link to Swift File
Link to Cloud Code handling Authentication

2016-03-01 23:59:49.646 Bars[10323:15114219] [Error]: {
    code = 107;
    message = "Received an error with invalid JSON from Parse: Cannot POST /classes/_User\n";
} (Code: 141, Version: 1.12.0)
2016-03-01 23:59:49.647 Bars[10323:15113659] -[__NSCFDictionary length]: unrecognized selector sent to instance 0x7fe0adc33a10```

Need a bower sample

We could just use postinstall to fire off bower install, or we could include this in the gulp sample

App Engine and Cloud SQL - connection lost issue

Hi,

I have forked the appengine/cloudsql project and deployed to google cloud however I am getting follow error Connection lost: The server closed the connection. each time I deploy the app. I am able to run application on my local machine using cloud_sql_proxy without any problem so it seems the issue is somewhere between app engine and cloud sql as Mysql connection is always dropping..

In app.yaml I am using follow MYSQL_SOCKET_PATH: /cloudsql/[YOUR_PROJECT_ID]:[YOUR_REGION]:[YOUR_INSTANCE_NAME]

Are there any changes in configuration or doc that I am missing?

P.S.: I am using second generation of Cloud SQL.

Thanks,
Martin

tasks.js sample fails in v1beta3

Using the latest sample, line 36 fails:

var datastore = gcloud.datastore.dataset(options);

Error: gcloud.datastore.dataset is not a function

Problem with the appengine-parse-server package

@jmdobry @JustinBeckwith
I added the liveQuery code in my server.js and now I can't deploy

push: {
      ios: {
        pfx: __dirname  + '/cloud/ParsePushDevelopmentCertificate.p12',
        bundleId: 'com.bundleIdName.appName',
        production: false
      }
    }
  liveQuery: {
    classNames: ['Message'];
  }
});
// Mount the Parse API server middleware to /parse
app.use(process.env.PARSE_MOUNT_PATH || '/parse', parseServer);
app.get('/', function(req, res) {
  res.status(200).send('Be Real');
});
var server = app.listen(process.env.PORT || 8080, '0.0.0.0', function() {
  console.log('App listening at http://%s:%s', server.address().address,
    server.address().port);
  console.log('Press Ctrl+C to quit.');
});
// Initialize a LiveQuery server instance, app is the express app of your Parse Server
let httpServer = require('http').createServer(app);
httpServer.listen(port);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);

ERROR


WARN

engine
 [email protected]: wanted: {"node":">=4.3"} (current: {"node":"4.2.3","npm":"2.14.7"})```

Don't know why I get this even though I put this in my package.json
`"node": "~4.3"`

**ERROR LOG: NPM DEBUG**
```0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: `node server.js`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:821:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd /Users/otymartin/Documents/dev/app-server
12 error Darwin 15.3.0
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
14 error node v4.3.1
15 error npm  v2.14.12
16 error code ELIFECYCLE
17 error [email protected] start: `node server.js`
17 error Exit status 1
18 error Failed at the [email protected] start script 'node server.js'.
18 error This is most likely a problem with the appengine-parse-server package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     node server.js
18 error You can get their info via:
18 error     npm owner ls appengine-parse-server
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]```

Vision API samples

  • - face detection
    • - CLI
    • - Unit tests
  • - label detection
    • - CLI
    • - Unit tests
  • - landmark detection
    • - CLI
    • - Unit tests
  • - text detection
    • - CLI
    • - Unit tests

memcache env vars

I copied this code and it took me some uploads to realize why memcache had problems

the env vars are called memcache and not memcached

Use a port picker to prevent port reuse

When running npm test, at least one test appears to hold on to port 8080 causing later tests to fail.

Rather than using port 8080 for all tests a port picker should be used for each test so that they don't interfere with each other.

Cannot deploy my app to App Engine after Installing Parse Dashboard

I followed all the steps to get the dashboard up and running, it works.

However, its created a problem for me. gloud preview app deploy gives me errors. It fails to deploy.

I installed the dashboard files within the same folder where I have my parse server.
Parse Server Directory: dev/appName-server/"server files, cloud code, app.yaml e.t.c
Dashboard Directory: dev/appname-server/parse-dashboard

When I run my command to deploy my server code gcloud preview app deploy I get this problem

Beginning deployment...

ERROR: (gcloud.preview.app.deploy) There is a Dockerfile in the current directory, and the runtime field in /Users/myUserName/Documents/dev/appName-server/app.yaml is currently set to [runtime: nodejs]. To use your Dockerfile to build a custom runtime, set the runtime field in /Users/myUserName/Documents/dev/appName-server/app.yaml to [runtime: custom]. To continue using the [nodejs] runtime, please omit the Dockerfile from this directory. 

Even After removing the DockerFile in my dev/appName-server/ directory, my deployment gets stuck at

Verifying that Managed VMs are enabled and ready.
Provisioning remote build service.
Copying certificates for secure access. You may be prompted to create an SSH keypair.
Building and pushing image for module [default]
--- DOCKER BUILD OUTPUT ---

Update: I deleted the parse dashboard from my server folder and reinstalled outside of it and the error still persists stopping me from deploying. gloud preview app deploy works when I delete the parse dashboard

Beginning deployment...
If this is your first deployment, this may take a while...done.

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Verifying that Managed VMs are enabled and ready.
Provisioning remote build service.
Copying certificates for secure access. You may be prompted to create an SSH keypair.
ERROR: gcloud crashed (TLSParameterError): Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See http://docs.docker.com/examples/https/ for API details.

How to add the environment variables in Windows?

I cannot figure out how to set the GOOGLE_APPLICATION_CREDENTIALS on Windows 10.

The documentation is pretty sparse.

I have Node setup OK, and cloned this repo.

I get the following error when running the command node recognize "resources/quit.raw"

Got audio file!
Loading speech service...
{ [Error: Google Cloud Speech API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.]
code: 403,
errors:
[ { message: 'Google Cloud Speech API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.',
domain: 'global',
reason: 'forbidden' } ] }

Why is it looking at the wrong project?

How do I set it to look at my project (I have a google project with speech api enabled)

Strings!

If I have

obj = {
valueType: 'INT64',
          points: {
            interval: {
              startTime: now,
              endTime: now
            },
            value: {

            }
          }
}

then i set

obj.valueType = 'STRING'; and obj.points.value.int64Value = 'some JSON'

I get

message: 'Invalid value at \'time_series[0].points.value.int64_value\' (TYPE_INT64),

I want to be able to send JSON to stack driver when an exception occurs in the program. Currently i'm only able to send integers.

OperationError: code=13, message=Error when creating Kubernetes cluster

Hi,
I'm trying to run the HelloWorld example to trigger an event for a GCS bucket activity. I get the following error. The APIs for container engine has been enabled for the project.

ERROR: (gcloud.alpha.functions.deploy) OperationError: code=13, message=Error when creating Kubernetes cluster for project

Thanks!

Datastore tutorial seems to depend on v1beta2

If a project already had v1beta2 enabled, the sample works.

But it fails with a new project even if v1beta3 is enabled. The error is "Service Unavailable - Backend Error". Enabling v1beta2 on the new project will cause the sample to work.

Wrong Port

Hi Google team,

the implementation of Parse Server:

app.listen(process.env.PORT || 8080, '0.0.0.0', function()

will lead to sporadic nginx 502 gateway errors. The official parse-server repo uses a different port.

Thanks.

Finish the endpoints samples

More TODOs after the bare sample is submitted. #105

  • Add a clients to send requests for echo, google_jwt, google_id_token.
  • Add tests.
  • Add error handling. See swagger spec for the error format.

can't deploy on app engine

when we try to deploy on appengine it doesn't work as expected. where can we get help on the matter? we've been trying for days to get a support answer, and nothing? who the fuck is in charge at google? anyone?

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.