Learn, Share, Build

232
September 23, 2017, at 01:36 AM

Hi i am trying to write a file in google cloud storage using node.js.

When i try to write the file, i get the following error

{
  "errors": [
    {
      "domain": "global",
      "reason": "badRequest",
      "message": "Invalid Upload Request"
    }
  ],
  "code": 400,
  "message": "Invalid Upload Request"
}

Below is part of the code used to write the file

const storageClient = require( '@google-cloud/storage' );
var storage = storageClient({ projectId: config.gcsProjectId }).bucket( config.gcsBucket );
var gcsStream = storage.file( this.config.fileName ).createWriteStream();
var entities = {}//huge json object;
Object.values( entities ).forEach( (json) => {
    var str = JSON.stringify( json );
    gcsStream.write( str + '\n' );
});
gcsStream.on('error', (err) => {
    console.error(`${ this.archive }: Error storage file write.`);
    console.error(`${ this.archive }: ${JSON.stringify(err)}`);
});
gcsStream.end();

I am using node 8.3.0, npm 5.4.1, @google-cloud/storage 1.3.0

Rent Charter Buses Company
READ ALSO
Learn, Share, Build

Learn, Share, Build

I'm completely new to NodeJS and I'm trying to get a project up and running where my client Javascript communicates with my Node

267
Learn, Share, Build

Learn, Share, Build

Microsoft release a new concept of Adaptive CardsMicrosoft Bot Framework implements Adaptive Cards in Botbuilder aside of HeroCard and other message type

192
Learn, Share, Build

Learn, Share, Build

I am using the pem module to read in a secret key from the PKCS12 keystore that was created with my Java classThe Java class works fine and I checked to make sure there were entries with keytool, but when I read the keystore file with node, nothing shows up

234
Learn, Share, Build

Learn, Share, Build

Thought I'd ask this as my team and I are banging our heads against this

286