gcloud-node

Delete folder in Google Cloud Storage using nodejs gcloud api

流过昼夜 提交于 2019-12-29 08:13:19
问题 I am using gcloud nodejs api to access Google Cloud Storage. I can save/delete/exists files individually, but I didn't find a way to delete a folder or even to list the files in a folder using gcloud nodejs api . I have seen people say that the folder hierachy in GCS is not a real tree structure, but just names. So I tried to use wildcard to match the file name string, which did not succeed. I wonder if there is any way to do it. If not, what tool should I use? 回答1: The code to list files in

NodeJS gcloud - Upload to google storage with public-read property/custom cache-expire

帅比萌擦擦* 提交于 2019-12-21 06:40:46
问题 I am trying to upload to google storage using the gcloud library (NodeJS). I need to enable public-read property and also set the cache-expiration to 5 minutes. I am using this (simplified) code: storage = gcloud.storage({options} bucker = storage.bucket('name'); fs.createReadStream(srcPath).pipe(bucket.file(targetFile).createWriteStream()).on('error', function(err) How do I go about setting the approprate ACL/cache expire? (I found this but not sure what to make of it: https:/

Google Cloud Storage - Error during upload: gcs-resumable-upload.json renaming operation not permitted

孤街醉人 提交于 2019-12-13 19:01:42
问题 I'm simply trying to follow this tutorial on how to upload files to gcs with Node and Express. But the following error keep causing my app to crash. Usually, I am able to upload one file without a problem in the first run. But I will get this error after running a few request, even with different file. When I try to upload, say 5, files at a time, this error cause my app to crash even in the first run. I see the process is trying to rename a file in the .config folder. Is it a normal behavior

gcloud Datastore transaction issue using nodejs

拜拜、爱过 提交于 2019-12-13 04:43:55
问题 I am using nodejs to contact the google datastore. This is my code: dataset.runInTransaction(function(transaction, done,err) { // From the `transaction` object, execute dataset methods as usual. // Call `done` when you're ready to commit all of the changes. transaction.save(entities, function(err) { if(err){ console.log("ERROR TRNASCTION"); transaction.rollback(done); return; }else{ console.log("TRANSACTION SUCCESS!"); done(); } }); }); If the save was not successful, I would like the

Argument [app.yaml] is not a valid deployable file google cloud error

随声附和 提交于 2019-12-11 16:32:28
问题 I'm going through the hello world tutorial on how to deploy a nodejs app to google cloud. I downloaded the google cloud sdk. I finished all the steps until "Deploy the app to Google Cloud Platform". When I get there, I enter the command they tell you to enter. It asks if you want to deploy the module and I said yes. Everything is fine until the end where it says Is this because my zone is set to us-central-f? I am in India. 回答1: It looks like your project was created in Europe. Unfortunately

gcloud socketIO is not working on multi-instances

£可爱£侵袭症+ 提交于 2019-12-10 22:24:42
问题 I am working with socketIO + Nodejs over gcloud app-engine with managed vms. I am facing a problem that when I use manual scaling, the gcloud working well with sockets. But when I use dynamic scaling, sockets not working at all, I think it doesn't work because of the port forwarding problem with two instances! here's my app.yaml instances handling that works. manual_scaling: instances: 1 resources: cpu: 0.1 memory_gb: 0.1 disk_size_gb: 10 When I remove them, sockets not works at all. Is there

“The caller does not have permission” error when creating new project using node gcloud

China☆狼群 提交于 2019-12-10 19:22:10
问题 I'm using node.js google api (npm gcloud package) to create a new project. this is a beta API. I'm getting an error: "The caller does not have permission" stack: ApiError: The caller does not have permission at new util.ApiError (C:\app\bundle\a2\node_modules\gcloud\lib\common\util.js:92:10) at Object.parseHttpRespBody (C:\app\bundle\a2\node_modules\gcloud\lib\common\util.js:170:30) at Object.handleResp (C:\app\bundle\a2\node_modules\gcloud\lib\common\util.js:110:18) at C:\app\bundle\a2\node

Node pagination in google datastore

心已入冬 提交于 2019-12-10 15:35:29
问题 I am having trouble doing the pagination with Google Datastore. I have a query which without the limit has a few hundred results. I would like to retrieve 5, send them back to the user, if the user wants more they would retrieve the next 5. Following the docs I create the query: var query = datastore.createQuery('ResultsKind').filter('name', 'bobby').limit(5).autoPaginate(false); I then run this query to get the first 5 results: datastore.runQuery(query, callback); This is the callback

Uploading a buffer to google cloud storage

此生再无相见时 提交于 2019-12-03 16:29:32
问题 I'm trying to save a Buffer (of a file uploaded from a form) to Google Cloud storage, but it seems like the Google Node SDK only allows files with a given path to be uploaded (Read / Write streams). This is what I have used for AWS (S3) - is the anything else similar in the Google node SDK?: var fileContents = new Buffer('buffer'); var params = { Bucket: //bucket name Key: //file name ContentType: // Set mimetype Body: fileContents }; s3.putObject(params, function(err, data) { // Do something

not able to perform gcloud init inside dockerfile

风格不统一 提交于 2019-12-03 12:51:11
I have made a Dockerfile for deploying my node.js application into google container engine .It looks like as below FROM node:0.12 COPY google-cloud-sdk /google-cloud-sdk RUN /google-cloud-sdk/bin/gcloud init COPY bpe /bpe CMD cd /bpe;npm start I should use gcloud init inside Dockerfile because my node.js application is using gcloud-node module for creating buckets in GCS . When i am using the above dockerfile and doing docker built it is failing with following errors sudo docker build -t gcr.io/[PROJECT_ID]/test-node:v1 . Sending build context to Docker daemon 489.3 MB Sending build context to