Hi everyone,
I’m building a booking system and need to generate available time slots dynamically using JavaScript. The logic is simple: take an open time, close time, service duration, and list of booked times — then generate available slots in between.
I’ve tried two approaches and both are blocked by Bubble’s CSP:
-
Toolbox “Run Javascript” action — blocked because Toolbox uses eval internally
-
HTML element with a <script> tag using setInterval — also blocked by CSP (script-src directive blocks it)
I’m on the starter plan so I can’t modify the CSP settings (that’s Growth plan+).
My question: is there any way to run custom JavaScript in a Bubble app on the starter plan that isn’t blocked by CSP?
Specifically I need to:
-
Read a few values (strings and a number) from Bubble
-
Do some simple time arithmetic in a loop
-
Return a list of strings back to Bubble (I’m using JavascripttoBubble from Toolbox for this)
Any workarounds, alternative plugins, or approaches would be hugely appreciated. Thanks!
The Toolbox “Run JavaScript” action actually works fine on the starter plan — the CSP issue you’re hitting is usually caused by how the script is structured, not the plan level.
A couple things to check:
- Make sure you’re using the “Run JavaScript” action in a workflow, not an HTML element with a
<script> tag. The HTML element approach will get blocked.
- The
JavascriptToBubble element needs to be on the page for the return value to work — it’s a visible element you drop onto the canvas.
For your time slot logic, put it directly in the “Run JavaScript” action body. Something like:
var slots = [];
// your loop here
bubble_fn_slots(slots);
Where bubble_fn_slots matches the function name you set on your JavascriptToBubble element.
One thing that can trigger CSP errors is using eval, setTimeout, or setInterval inside the script — avoid those. Straight synchronous logic in the Run JavaScript action body should work without issue on starter.
What does your current Run JavaScript action look like? That would help narrow down where it’s failing.