Sending Files from Supabase to OpenAI api

Hi all,

I’m trying to send files to OpenAI for analysis that the user can source from Supabase Buckets.

When I generate the signed URL and access it, I only get a return of : [object Object]

Any ideas?

The flow would be something like this:

User selects files, they get loaded, we build an array with all the URLs for the files, we input that into an Edge Function.

Now I just can’t get those URLs to work.

I have tried with Public Bucket, Private and yes, I do have policies.

1 Like

Hi Emeric :waving_hand:

It looks like your flow is mostly correct, and the issue is happening specifically at the step where you generate and read the signed URLs from Supabase, not in the file selection or Edge Function call.​

Where the issue seems to be

From what you described, these parts are working:​

  • You can select files and load them in your app.
  • You build an array of file references and send it to an Edge Function.

The problem shows up when you “generate the signed URL and access it” and only see [object Object].​
That usually means the variable you are logging or sending to OpenAI is a JavaScript object (for example, the full response from Supabase) instead of the actual URL field as a string, or that the object is being implicitly converted to a string.​

Questions to help troubleshoot

To help you more concretely (and so others can jump in as well), could you share:​

  • The exact code you are using to generate the signed URL (both in the Edge Function and/or in WeWeb), including the line where you log or see [object Object].
  • A console.log (or similar) of the full Supabase response before you try to use it as a URL, so we can see which property actually contains the signed URL.
  • The OpenAI request snippet: how you are passing the file to the API (which field you use and what value you send there, a string URL, an object, or an array).
  • Bucket details: is the bucket public or private for this test, what the file path looks like, and a sample signed URL generated directly from Supabase (dashboard or simple script) to confirm that signed URLs work as expected outside of WeWeb.

With those details, it will be easier to figure out your issue.

Hi @Agustin_Carozo have a look at this:

Experta2_0_Supabase | WeWeb
Watch Video

1 Like

Hi Emeric, thanks for the video, it helped a lot to see what you were doing!

I tried replicating your project and I think I figured it out.

on the “file” path on your upload action you are using the local data of the file uploader (in orange), and instead you should be using the component result (in green).


Can you try that and let me know if it works?

3 Likes

I think its working. I’ll do some more testing.

Thanks a lot @Agustin_Carozo . Really appreciate it.

2 Likes

Hi @Agustin_Carozo how are you approaching loops then? Would we map to the context variable from the workflow?

I’m thinking when you load multiple files.

EDIT: Or the action is smart enought to not required the loop?

Hi Emeric,

Samuel, a community member created this tutorial for this:

But basically yes, you need to use a loop to iterate through each item in a file upload element.