Weird Behavior Suddenly Going on with Run Javascript (Toolbox) Plug-in

Hmm… So, I’m all-of-a-sudden getting errors from @mishav’s Run Javascript for stuff that’s been working perfectly for quite some time. Almost like the functions/scripts in question are not loaded, but I have extensive checking to ensure that they are.

After calling moment-range (which IS defined), I’m getting this error in the console:

And this accompanying error in Bubble’s debugger:

This reminds me of behavior we’ve seen when there’s something generically wrong with Bubble / some update gone awry. Anyone else seeing errors that should not be present???

(This is happening both to the LIVE version of my app [that has been error free and NOT updated recently] as well as DEV version of my app where there are many pending changes to push to live.)

-K-

I tried it a few minutes ago, and had a similar problem. Now it seems to be loading okay.

Comparing notes: I was loading moment.js from cdnjs, in a HTML element with script src=… and using it in Expression …

Screenshots

showing no results …
2018-10-30%2015_52_46-My%20Page

console errors …

now showing okay, no console errors …

2018-10-30%2016_00_29-My%20Page

I’ll chime in only because my app’s strange behavior starting yesterday also involved javascript. I’ve been loading some of those “site seals” for months and we’re suddenly getting an error that the seal does not belong to the current domain. I’ve had bigger fish to fry, so really have drilled into this one yet…but can do so if it helps the cause!

1 Like

Did it have an earlier error when linking it to moment?

window["moment-range"].extendMoment(moment)
Uncaught ReferenceError: moment is not defined

No, because I check for that before continuing and attempting to call moment.

Weird thing about this error I’ve been getting is it’s in moment-range, but moment-range is defined.

Is the error still occurring?

How are you loading the library for moment-range? And which function causes the error?

I’ll check it in the AM, done for tonight! I load moment-range in HTML element as the widget this is in is a reusable.

FYI on your sample page … https://grupz.com/bookwidget-embed/1533598513737x940983987061391400

The widget is working, and the console messages look okay for moment-range.

Hah, I just reloaded it, this time white calendar cells, loads of console errors …

EDIT - “Moment Timezone requires Moment.js” shows before “Moment is ready!”

console log
unreachable code after return statement[Learn More] 
JQMIGRATE: Migrate is installed, version 3.0.0 xfalse:4:440
Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/ moment-timezone-with-data.js:481:4
logError
https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.21/moment-timezone-with-data.js:481:4
<anonymous>
https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.21/moment-timezone-with-data.js:35:3
<anonymous>
https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.21/moment-timezone-with-data.js:16:3
<anonymous>
https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.21/moment-timezone-with-data.js:7:2
TypeError: moment is undefined[Learn More] moment-timezone-with-data.js:38:6
page is loaded 
Moment is ready! 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
unreachable code after return statement[Learn More] 
Waiting for Moment.tz... 
Waiting for Moment.tz... 
Waiting for Moment.tz... 

Unreachable code message is new to me…is this indicative of cdnjs being slow?

(The console log messages about loading are me, noting checks for load status. Notifications not errors. )

Unreachable code I think is because on this browser I’m blocking some stuff like facebook, analytics, etc.
I get that all the time, but not on a completely unblocked browser.

Ah. Gotcha.

But basically something isn’t loading right and nothing’s changed in my site. It’s something external.

Hmmm this might be related … I just allowed the cookie consent script to run, now all the moment stuff loads okay.
Back to disallow the cookie script and reload, still okay, probably cached … hard reload still okay …
This one was disallowed by Ghostery as a tracker … https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/1.0.9/cookieconsent.min.js

I think its only related in terms of timing, the issues I saw earlier was on an open browser.

Yeah, but the behavior I was getting is with me Logged in and cookie consent cleared. All the business with checking for functions being available was to avoid issues with attempting to access moment related functions until we’re sure those functions are defined (and that all works).

Also, I can get that error AFTER a moment-range call has already completed successfully. (That is, select a range, successfully get a quote. Select a new range, also works. Select another range — boom, mystery error. Which is to say: this error doesn’t have to do with moment-etc being loaded, but some other flakiness somewhere… it’s not reliably reproducible.)

And this morning, I’m unable to reproduce/generate the error at all, but I did have a report from a user in the UK of this happening to them.

It’s a baffler.

… And, just an update on this oddball issue: I’ve still not been able to reproduce it today, but have a feeling it could have been related to (1) capacity in my app (I’ve added some capacity as it was definitely time to do that) and (2) it does seem that the @Bubble team pushed some sort of update that may have tickled this behavior and then pushed an update that might have resolved it. I’ll note that I’ve not pushed an update to my live app since Oct 26th, but this morning I noticed while testing my live mode that I got the “we just updated the app - reload” message (so it would seem something updated in Bubble, but not something specific to my app).

BTW, I am not complaining about Bubble constantly being improved! (Push all the helpful updates you can, folks! :wink: )

@keith and @mebeingken did you happen to download your app before and during the problem, to see if there is a difference?

@emmanuel was there a recent code change that could affect the timing of HTML elements, jquery or javascript library loading?

I definitely have “a” version of the app from before my problem first popped up, but most likely there were several changes after that download.

But I’m in a bit of a pickle right now as I have this bizarre issue within my app that support is looking at. I’m reluctant to make any changes until I understand what is going on.

Have a look at this video. You’ll see that as I click on events, the event itself changes. I then revert my app back to what is correct, and can repeat this multiple times. Makes me feel like something has gone awry within the app structure or something.

I’d guess that issue with the app editor comes from one of:

. A corrupted workflow step or event,
. Using too much memory,
. A HTML element on the page (this element gets rendered by the editor) with a script that is messing with the editor’s script. This possibility can be ruled out by copying the page, then remove any HTML elements.

How are you loading the javascript? For example, page header, HTML element, or Run Javascript? Do you do script src, pasted in script, or jquery getScript? Do you have any dynamic expressions mixed in with the script?

1 Like

How are you loading the javascript? For example, page header, HTML element, or Run Javascript? Do you do script src, pasted in script, or jquery getScript? Do you have any dynamic expressions mixed in with the script?

HTML element:

<div class='hd-seal'><div class='seal-three' style='position: relative; display: inline-block'></div><div class='sealCode' data-seal-src='https://app.trustlock.co/xyz/my-badge/abc' style='display: none;'></div><script type='text/javascript' src='https://app.trustlock.co/js/seal-api.js'></script></div>

And nothing dynamic.