Giter Club home page Giter Club logo

Comments (8)

stephenplusplus avatar stephenplusplus commented on August 12, 2024

That's not fun at all. According to these docs: https://cloud.google.com/storage/docs/json_api/v1/status-codes that means somewhere along the way we made a "bad request". I'll jump on a computer later and try to reproduce. If you're up for some console.logging in the mean time, feel free :)

from gcs-resumable-upload.

stephenplusplus avatar stephenplusplus commented on August 12, 2024

Would you put a console.log(resp.toJSON()) at this line and paste the output?

from gcs-resumable-upload.

 avatar commented on August 12, 2024

TypeError: Cannot read property 'toJSON' of undefined (resp is undefined).

I get the same errors array when I console.log(JSON.stringify(body)); on line 210 and the resp object there is a little too big to paste.

I believe that the callback at line 214 is what's causing resp to be undefined on line 89.

from gcs-resumable-upload.

stephenplusplus avatar stephenplusplus commented on August 12, 2024

Woops, sorry for sending you down that road that was clearly wrong. Instead of logging resp, resp.toJSON() should produce a much more copy-pastable object.

from gcs-resumable-upload.

 avatar commented on August 12, 2024

Could this be the solution? I've created a bucket with a service account, and I'm trying to access it with that same service account, but do I need to give that service account write permissions? http://stackoverflow.com/a/17978592

I've removed what I believe to be potentially sensitive info, hope I didn't screw anything up.

{ statusCode: 400,
  body: { error: { errors: [Object], code: 400, message: 'Required' } },
  headers: 
   { 'x-guploader-uploadid': 'XXXXXX',
     vary: 'Origin, X-Origin',
     'content-type': 'application/json; charset=UTF-8',
     'content-length': '163',
     date: 'Wed, 02 Sep 2015 23:25:46 GMT',
     server: 'UploadServer',
     'alternate-protocol': '443:quic,p=1',
     'alt-svc': 'quic=":443"; p="1"; ma=604800',
     connection: 'close' },
  request: 
   { uri: 
      { protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'www.googleapis.com',
        port: null,
        hostname: 'www.googleapis.com',
        hash: null,
        search: '?name%5B_bsontype%5D=ObjectID&name%5Bid%5D=U%C3%A7%C2%85ze%C3%98%C3%A232%22%02%C2%A3&uploadType=resumable',
        query: 'name%5B_bsontype%5D=ObjectID&name%5Bid%5D=U%C3%A7%C2%85ze%C3%98%C3%A232%22%02%C2%A3&uploadType=resumable',
        pathname: '/upload/storage/v1/b/thebucket/o',
        path: '/upload/storage/v1/b/thebucket/o?name%5B_bsontype%5D=ObjectID&name%5Bid%5D=U%C3%A7%C2%85ze%C3%98%C3%A232%22%02%C2%A3&uploadType=resumable',
        href: 'https://www.googleapis.com/upload/storage/v1/b/thebucket/o?name%5B_bsontype%5D=ObjectID&name%5Bid%5D=U%C3%A7%C2%85ze%C3%98%C3%A232%22%02%C2%A3&uploadType=resumable' },
     method: 'POST',
     headers: 
      { Authorization: 'Bearer XXXXXXX',
        accept: 'application/json',
        'content-type': 'application/json',
        'content-length': 2 } } }

from gcs-resumable-upload.

stephenplusplus avatar stephenplusplus commented on August 12, 2024

I think the problem might be the filename:

name%5B_bsontype%5D=ObjectID&name%5Bid%5D=U%C3%A7%C2%85ze%C3%98%C3%A232%22%02%C2%A3&uploadType=resumable

Translated:

name[_bsontype]=ObjectID&name[id]=Uç�zeØâ32"�£&uploadType=resumable"

Looks like maybe you're giving an object as the file property instead of a string?

from gcs-resumable-upload.

 avatar commented on August 12, 2024

OOOPS! You're totally right. Forgot a simple .toString(). Sorry for the headache. 😵

from gcs-resumable-upload.

stephenplusplus avatar stephenplusplus commented on August 12, 2024

No problem, glad we got it solved! :)

from gcs-resumable-upload.

Related Issues (20)

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.