The Bunny.net Cloud Storage plugin is a powerful tool that enables users to effortlessly connect their Bubble applications with the high-performance cloud storage solution offered by Bunny.net. With this plugin, you can easily create storage zones to store and manage files within your application.
How to setup
Place the plugin’s element “Bunny Storage” on the page and fill the field “API key” with the Bunny.net account API key .
Where to get the Access key for account - in the profile dashboard :
Where to get the Storage Zone passwords you will need for storage zone actions - from the dashboard or other API calls (”List Storage Zones” or “Get Storage Zone”).
From the dashboard:
Where to get the Storage Zone hostname - from the dashboard or other API calls (”List Storage Zones” or “Get Storage Zone”).
From the dashboard:
The id of the last created storage with "Add storage zone" action. It is a number that is returned after the storage has been created successfully.
Error message
The message of the caught error in any of the element’s actions.
Plugin’s Element Events
Title
Description
File uploaded
Triggers if the response of the "Upload file" action is success, informs if the file was uploaded successfully.
File deleted
Triggers if the response of the "Delete file" action is success, informs if the file was deleted successfully.
Zone added
Triggers if the response of the "Add storage zone” action is success, informs if the zone was successfully added.
Storage zone updated
Triggers if the response of the "Update storage zone” action is success, informs if the zone was successfully updated.
Storage zone deleted
Triggers if the response of the "Delete Storage Zone” action is success, informs if the storage zone was successfully deleted.
Password changed
Triggers if the response of the "Reset password" or "Reset read-only password" action is success, informs the user if the storage password changed.
Returned error
Triggered when an element's action returns an error.
Plugin’s Element Actions
Upload file
Upload a file to the user's Storage Zone mentioned.
For opening a plugin file uploader when the action is called and upload files directly from a device not from bubble uploader, keep "File" and "Base64 File" fields empty. Once one of them has data the plugin's element Uploader does not open on action call.
Action fields:
Title
Description
Type
Zone password
The password of the Storage Zone you want the file to be uploaded in.
You can find it in dashboard - “storage zone” - "FTP & API Access".
You can also get it from “Get Storage Zone” API call response.
Text
Hostname
The endpoint of the uploaded file, please check the documentation here - "https://docs.bunny.net/reference/put_-storagezonename-path-filename".
Also it is mentioned in “storage zone” dashboard "FTP & API Access", "hostname" field.
You can also get it from “Get Storage Zone” API call response.
Text
Storage zone name
The name of your storage zone where you are connecting to.
Text
Path
(Optional)The path to the folder where your file will be stored. If this is the root of your storage zone, you can ignore this parameter. If you do not have a folder but want the file to be uploaded in one, just insert a path and the file will be created there.
Ex: folder/subfolder1
Text
File name
(Optional) The name of the uploaded file. Empty field uses the original file name. Provided file name without a extension uses original file extension. Provided file name with extension uses fully the field's value, please be careful at used extensions, they should be mentioned right. Do not repeat existing names, that may cause difficulties saving a new file to the cloud. If you use bubble Uploader for a better experience use its provided file name state here in the field value. For base64 encoded files this field is required.
Text
File
(Optional) The file URL of the file that will be uploaded. Let this field empty when calling this action if you want to upload files directly from device to Bunny, not implementing a bubble Uploader.
File
Base64 File
(Optional) Use this field if you want to upload to Bunny a file encoded in base64. If this field has a value, "File" will be automatically be ignored. Base64 files do not include filename so it is required to set a file name with its extension in the corresponding field above.
Text
Delete file
Delete an object from the storage zone. In case the object is a directory all the data in it will be recursively deleted as well.
Action fields:
Title
Description
Type
Zone password
The password of the Storage Zone you want the file to be uploaded in.
You can find it in dashboard - “storage zone” - "FTP & API Access".
You can also get it from “Get Storage Zone” API call response.
Text
Hostname
The endpoint of the file, please check the documentation here - "https://docs.bunny.net/reference/put_-storagezonename-path-filename".
Also it is mentioned in “storage zone” dashboard "FTP & API Access", "hostname" field.
You can also get it from “Get Storage Zone” API call response.
Text
Storage zone name
The name of your storage zone where you are connecting to.
Text
Path
(Optional) The path to your file folder. If this is the root of your storage zone, you can ignore this parameter.
Ex: folder/subfolder1
Text
File name
The name of the file that you wish to delete.
Text
Download file
Download a file from the storage zone.
Action fields:
Title
Description
Type
Pull zone hostname
The password of the storage zone where the folder/file is located.
You can find it in “storage zone” dashboard "FTP & API Access".
You can also get it from “Get Storage Zone” API call response.
Text
Path
The path to your file folder. If this is the root of your storage zone, you can ignore this parameter.
Ex: folder/subfolder1
Steps for the plugin’s element action “Download file” to work:
From your account dashboard, access the Storage Zone you want to make the access to the file public and click there “+Connect Pull Zone”.
From the opened popup, click “Add Pull Zone”.
Give the pull zone a name and again click “Add pull zone” on the bottom.
Save the hostname of the pull zone, as that is the one you will use for downloading files.(Keep in mind that for other actions is used storage hostname, not the pull zone one.)
Navigate to pull zone “Edge Rules” and create one. You need that for the file to be downloaded when the action is called.
Give it a description and from the Action dropdown, choose “Force download”.
For condition matching add your pull zone hostname + “/*” to do the same action for all type of files and save the edge rules.
After setting the Storage Zone right you can easily implement the plugin’s action “Download file” in your app.
Add storage zone
Add a storage zone to bunny.net cloud storage account.
Action fields:
Title
Description
Type
Name
The name of the storage zone. Has to be a unique value(can not repeat another storage zone name), longer than 5 characters and with no space.
Text
Region
The code of the main geographical location where the data is physically stored (Possible values: DE, NY, LA, SG)
(Optional) Suppose you have a website hosted at www.example.com.
This is your origin URL – the primary location where your website's content is stored.
Text
Replication regions
(Optional) The list of the geographical locations codes where your data is physically stored (Possible values: DE, NY, LA, SG)
Text
Update storage zone
Updates the data in the storage zone with the one filled in the inputs.
Action fields:
Title
Description
Type
Id
The ID of the storage zone that should be updated.
Text
Advanced Settings:
Replication zones
(Optional) The list of the geographical locations codes where your data is physically stored (Possible values: DE, NY, LA, SG)
Text
Origin url
(Optional)The origin URL of the storage(Optional)The origin URL of the storage zone.
This URL represents the address of your primary server or the location where your original content is hosted.
When bunny.net receives a request for your content, it will fetch it from this URL if it's not already cached in their CDN.
Remember that the exact URL will depend on where your content is hosted. It could be a URL to a specific server (like in the example above), a cloud storage service, or another type of content repository. The key is that it must be a URL that bunny.net can access to retrieve your content. zone.
Text
Custom 404 file path
(Optional)The path to the custom file that will be returned in a case of 404.
It's important to note that this file path is relative to the root directory of your server or hosting environment. You need to have the 404.html file (or whatever you name your custom error page) located at the specified path on your server.
Text
Rewrite 404 to 200
(Optional) The rewrite rule doesn't create new content; it only redirects requests for missing content to existing content (like a custom error page). Bunny.net's servers will check the rewrite rule you've set up in the Storage Dashboard. Seeing the rule, the server will fetch and serve the specified target resource. For more information check here : https://bunny.net/blog/host-your-frontend-applications-on-the-edge/
yes/no
Delete storage Zone
Action fields:
Title
Description
Type
Id
The Storage Zone ID that should be deleted.
Text
Reset password
Reset the account password. It does not return its new value.
Action fields:
Title
Description
Type
Id
The ID of the storage zone that should have the password reset.
Text
Reset read-only password
Reset the read-only account password. It does not return its new value.
Action fields:
Title
Description
Type
Id
The ID of the storage zone that should have the read-only password reset.
Text
Plugin API calls: Bunny.net Storage
List Storage Zones
Gets the profile list of storage zones with the corresponding information about them. API call used as “Data”.
(Optional) Insert as a dynamic value of the current time (format as Simplified extended ISO) if you need your list data to be always up to date, otherwise ignore the field.
Date
Check the storage zone availability
Checks that storage zone is properly allocated and accessible. API call used as “Action”.
Returns in the response the “Available” filed with its values yes or no.
The name of your storage zone where you are connecting to.
Text
Path (path)
The directory path that you want to list.
Text
AccessKey (header)
The storage zone password.
Text
Date
(Optional) Insert as a dynamic value of the current time (format as Simplified extended ISO) if you need you list data to be always up to date, otherwise ignore the field.
Date
Changelogs
Update: 30.04.24 - Version: 1.3.0
Added "base64" field and Bunny Uploader
Update: 05.06.2023 - Version: 1.7.0
Fixed the PNG format ///empty - this is just example