muxinc / upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
MIT License
329 stars 46 forks source link

Retrieving Asset ID after upchunk finishes an upload? #123

Closed oscklm closed 6 months ago

oscklm commented 6 months ago

Is there a specific reason behind upchunk not returning any kind of asset id, after it finishes an upload?

In my opinion, this should definitely be added - as it's extremely useful to store in database when saving the succesfull upload into my database when upchunk finishes.

Currently i save the uploadId instead, and then later retrieve the asset from the webhook using the uploadId, but after that i never have any use for that uploadId again. But the asset id is the one actually being useful for many things.

Please let me know, if i've misunderstood something here. But it just seems like something is missing in the library, or a better explanation in the docs.

mmcc commented 6 months ago

No, UpChunk just handles shipping chunks to the a storage backend (GCS in our case). It doesn't know anything about assets or anything along those lines.

Totally agree that the workflow isn't ideal right now, but UpChunk is probably never going to be the thing that directly returns any internal information since it's intended to be run in client environments. Definitely a workflow we're trying to improve, though!

We talk through a full upload workflow in the docs, but it since you're already using webhooks directly I doubt you'll get too much new. Does that workflow clear anything up?

If you're open to chatting through ideal workflow ideas I'd love to hear your thoughts, feel free to shoot me an email (matt at mux) and we can find a time!

oscklm commented 6 months ago

This clears up everything, that had me previously confused. I get the point of it being intended to run in a client environment.

I'd love to share the way we ended up doing it, and specifically in conjunction with our convex backend. I'll get back to you in an e-mail with more info, and setup a little example in a repo or something - for others to get inspiration from.

Thanks Matthew.