Bubble applicant API Workflow not correctly storing remote file objects via API

(I plan to submit a bug, but thought I’d post the question in the event anyone else was having this problem.)
I’m using a Workflow API to store attachments into an object in Bubble.

Here you can see the endpoint is expecting a value of type “attachment_file” which is of type “file”.

This file value will then be stored into the “Letters” table in Bubble.

The expected behavior is that this attachment should then be stored inside of the Letter object as a file. Instead, it is being stored as a reference to the Zapier file and not the attachment. (Unfortunately, we don’t have access to any log files to see exactly what Bubble is importing.)

Now I know that the object being sent to Bubble is actually a file. I am also sending the same object to Dropbox and it’s being stored as a file, too. The images above shows the dropbox URL which is correct and I can see the files in Dropbox. Bubble, however, is not storing a file. Also, as seen below, the file_url is not pointing to Bubble’s amazon S3 storage, instead it is pointing to Zapier’s temporary file store. So it lokks like the Bubble API workflow is storing the file URL instead of the actual file object, then also using the attachments URL instead of just uploading the file and using the amazon S3 url.

So I decided to test this out by first importing a file via the API and then updating it via Bubble. In that first image above you see the data table with the file URL pointing to Zapier. After uploading a new file (clicking on the file and uploading a new one in the edit menu). You can now see the Amazon S3 url.

This is incredibly important since the Zapier file reference is only temporary. The file has to be uploaded into Bubble for it to persist. Thanks.

This isn’t a bug, this is by design (from the beginning). Every file in Bubble is represented as a URL. If you need to access the raw file, you have some ways to get the file from the URL (Blockspring custom blocks for instance) and then send the content to another service. We don’t support this out of the box, but you can do this.

Well look at how we can add this to Bubble, but no promise nor timeline.

Thanks for responding @emmanuel. I completely understand that correctly. Every major cloud storage uses links to represent files. Maybe I wasn’t clear in my explanation, but that is not the problem.

When I upload a file directly through Bubble using the File Upload component, the file is uploaded to Bubble and stored on your S3 instance.

When I do this using the API, this does not happen. When I upload through the API Bubble isn’t uploading the file and storing it on Bubble’s Amazon S3 instance. It is just only storing a text reference the temporary file URL Zapier is providing. The Bubble API should work just as if I were uploading it using the File Uploader but it’s not. It should grab the file from the URL then upload it to your S3 instance. The Zapier link is intended to only be a temp link so that my Bubble API can accept the files and store it permanently.

Does that help explain the problem I’m experiencing?

1 Like

Oh right. Well we don’t support uploading file via the API. This is unfortunately not an easy fix.

Thanks for the response.
Feel like I just took a huge punch in the stomach since this is a huge requirement for my app. I’m pulling in attachments from emails and this becomes a critical issue for me. Can I make a plea for this? I’m also going to try and think of another way around it. Maybe I’ll just feed the Dropbox URL to the file variable and see how that pans out.

This is a major infrastructure project, the enable streaming files to our servers, and not something we can do quickly unfortunately. We’ll talk about it internally, but don’t expect a quick turnaround on this, sadly.

Hey @emmanuel- do you support uploading files via the API connector as yet?

No, but by the API Workflow yes.

1 Like

Thanks as always for you prompt response!

We were wondering if ‘multipart form’ uploads ares supported via API workflow?
ref: https://documentation.onfido.com/#upload-document

I’m trying to recreate this POST request in the Bubble Connector. One of the parameters requires loading a file. Does Bubble support this use case?

What does “but by the API Workflow” mean? How do I initialize the POST call in Bubble if “file” is missing?

Hi @emmanuel - Thanks for all your helpful responses on this forum, they have really helped me get up and running!

I just saw this below comment indicating the files can be uploaded via the API workflow which is something I am having trouble with now. Would you be able to point me to the reference material on how to do this?

The specific issue I am having is that I am sending a pdf file to my bubble endpoint, and it is showing up as shown below:

image

Is there any way to accept this file into bubble as Key = pdf_file_attachment; Type = File? (See below for example)

image

If this won’t work as described, is there another way to get a pdf file into bubble using the endpoint?

Thanks so much!

Yes, you need to send this as described here

If you have some issues, please share the Curl or Postman request so that other people can help.

Wonderful, thanks so much!

When I do this, I receive the file in bubble as shown here:

image

What is this and how do I use it? Ljava.lang.Object;@1deac6ee

I am trying to store the information in a customer PDF object as follows:

image

It creates a data entry as follows:

image

Then I try to access it through a link element as shown below:

image

I have been unable to figure out how to make this work and any help would be incredibly appreciated!

Thanks again!

@emmanuel Here is the Curl (truncated due to length). I have been struggling with this for a few days now. At the moment, I am still not able to save and use the file. Any help you might be able to offer would be greatly appreciated.

CURL:

{pdf_page_count=7.0, email_date=Saturday, October 7, 2017, pdf={filename=15ef4681b942a723.pdf, contents=JVBERi0xLjUKJb/3ov4KMTggMCBvYmoKPDwgL0xpbmVhcml6ZWQgMSAvTCAxODk0MTI4IC9IIFsgNzYxIDE2OSBdIC9PI…

I then try to save the “pdf” that results.

I tried once with “saved to s3”…

Doing it this way, no record was created for Gmail object.

Next, I tried to save pdf this way (without the “saved to s3”):

Doing it this way a Gmail object was created with the following data:

I was not able to view the pdf or get the right filename using this object. It also didn’t show the s3 url like pdf objects usually do in this data viewer.

Thank you again for any advice and guidance you can provide!

It seems like you are not sending the data in the correct way with curl. It should be stringified JSON object and you should have a content-type as application/json. Can you share the whole request (truncating the pdf)?

Is it still the case that uploading files via the API is not supported?

I’m encountering the same issue that @saeed.t.richardson described five years ago - trying to move images from an AWS bucket into Bubble via Zapier but finding my original AWS link is getting stored in the image field in the Bubble back end as opposed to a link to the file on Bubble’s AWS bucket. That subsequently means that integrated Imgix processing doesn’t work, and the images are broken in the Wonderful Image Slider plugin, and both of those things are big problems for my use case.

It sounds like an alternative could be to get data into Bubble and then kick off an API workflow to lookup and import the images that way. Or just brace myself for manually uploading a few thousand images after getting the rest of the data moved via Zapier.

With some help from Matt at @RapidDev, I was able to make Zapier import all my data including images. The key is to configure an API workflow that makes changes to a thing’s image fields with a URL that leverages the saved to S3 action. Then in the Zap, after the step which creates the Bubble thing, add another step that sends the image URLs and the ID of the just created thing to the API workflow. :tada: