Sending a CSV to Xano using the Bubble API connector when the uploaded file is private
You need to use a Bubble API key.
After resolving the back-end problems associated with parsing a CSV on the Xano side, I turned to the front-end. Although I could now get Xano to process CSVs, I was having problems sending them from Bubble.
After encoding the file as base64 and having it sent via API to Xano, it would decode into weird text:
{"error_class":"Unauthorized","args":{"code":"1670957944426x137539456986082160"},"message":null,"translation":"Permission denied"}
After much troubleshooting, reviewing Xano and Bubble blogs, and going to Xano office hours, I figured out what the problem was.
The error I got was the result of me marking the file as “private” in Bubble. Having the data be publicly available was not an option for me, so I needed a way to protect it.
Bubble, however, does not let you send private files through the API connecter. Fortunately, I found a crazy workaround that still allows you to keep the file private. Check out this post for the original, but see below for more details and explicit steps.
1) Enable the Bubble API for workflows and generate a Bubble API token.
2) Combine the file’s URL (the location where it is stored after using the Bubble FileUploader) with a Bubble API token to give the Bubble API connector access to the underlying data and send it to Xano.
3) For good measure, delete the file at the end of the process to prevent your storage from being overloaded and also set the encoded value to 0. There is no reason to retain any data in the front end that you don’t need, so deleting it removes a potential security risk.
Amazing!