Skip to main content

Does copying base w/ script block break the script block in the copy?

  • March 23, 2020
  • 5 replies
  • 28 views

Forum|alt.badge.img+18

I created a copy of a base with a functioning script block in it (by functioning I mean it works without throwing errors), to tinker with some updates to the script. But when I run the script in this “copy” of my base, I get an error that sounds a lot like the Script Block is either trying to access the original base ID, or else has an undefined base ID … on second look, it seems to be getting through the async queries at the beginning of the script, right?.. or else it wouldn’t even hit the output.markdown() before throwing the error… :

Clearly, I don’t have any access to globalThis.

@Stephen_Suen, @Kasra, @Shrey_Banga - able to weigh in on this?

5 replies

Forum|alt.badge.img+18
  • Author
  • Inspiring
  • 1691 replies
  • March 23, 2020

:thinking:

… I copied the code from the script block, created a fresh Scripting Block in the “copy” of my original base, and pasted the script into the fresh Scripting Block – same error when running the script. What am I missing here?


Forum|alt.badge.img+4
  • Inspiring
  • 192 replies
  • March 23, 2020

Sorry! We pushed out an update this morning which appears to have some bugs, we’re rolling it back now.


Forum|alt.badge.img+4
  • Inspiring
  • 192 replies
  • March 23, 2020

Should be fixed now, apologies for the disruption.


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • March 23, 2020

Wild guess - globalThis is a static variable (like a script variable) that is scoped to the original base and established when you created the script block. Then, you copied the base, and the script block magically came along in that copy process and somehow, this dependency got lost in translation.

Have you tried to create a new script block in the copied base from the exact same code to see if it runs without error?

I just created a copy of a base that contains 12 script blocks and all seem to be running fine.

UPDATE: I must have missed playing with the bad push. Glad it’s resolved.


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • March 23, 2020

Thanks for asking this! I was getting an error earlier today and was confused.

ReferenceError: globalThis is not defined

It’s working now.