Giter Site home page Giter Site logo

Comments (4)

nipunn1313 avatar nipunn1313 commented on June 3, 2024 1

there you go! Nice debugging!

from convex-demos.

nipunn1313 avatar nipunn1313 commented on June 3, 2024

Hi. It is supported. The storage upload via upload URL is framework agnostic.

Could you provide your code? What API call(s0) are giving an undefined storageId?

from convex-demos.

varand-pez avatar varand-pez commented on June 3, 2024

Hi Nipunn and thank you for getting back to me.

My code is identical to documentation, I set the file's uri in state and upon upload click I call this code:

const postUrl = await generateUploadUrl();
      console.log({ postUrl });
      const result = await fetch(postUrl, {
        method: "POST",
        headers: { "Content-Type": "image" },
        body: myImage
      });
      const { storageId } = await result.json();
      console.log({ storageId });
 LOG  {"postUrl": "https://graceful-[partOfURL].convex.cloud/[partOfURL]upload?token=[SOMETOKEN]"}
 LOG  {"storageId": undefined}

I did more digging and was able to find the issue, I logged out the complete response (instead of just {storageId}) and this is what I see.

{"res": {"code": "BadHeader", "message": "Bad header for content-type: invalid HTTP header"}}

is hardcoding the contentType to image the problem?

Thanks.

from convex-demos.

varand-pez avatar varand-pez commented on June 3, 2024

just ignore it already, it has to be image/*

from convex-demos.

Related Issues (16)

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.