workspaceToCode returns text is null (after upgrading Blockly)

108 views
Skip to first unread message

Mayo

unread,
Oct 30, 2019, 2:44:45 PM10/30/19
to Blockly
Hi,

I tried upgrading Blockly from 2.20190722.1 to 3.20191014.4 but now when I try to drop a block from the toolbox into the workspace I get an error 'TypeError: text is null` when running `Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace())`

When I replace Blockly back to the older version it works for me, has anyone else run into this issue?

Thanks.

Neil Fraser

unread,
Oct 30, 2019, 3:07:56 PM10/30/19
to blo...@googlegroups.com
Hmm, that's not an error we explicitly throw.  Can you provide the full error stack?  Even if it is compressed, it would help narrow down the location.

Just a hunch: have you programmed any custom fields in your application?

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/ea7d69b9-d729-4487-8e96-c0e32fc77342%40googlegroups.com.


--

Mayo

unread,
Oct 30, 2019, 3:19:01 PM10/30/19
to Blockly
I've attached a screenshot of the error stack. 
I don't believe there are any custom fields, only custom blocks.


On Wednesday, October 30, 2019 at 3:07:56 PM UTC-4, Neil Fraser wrote:
Hmm, that's not an error we explicitly throw.  Can you provide the full error stack?  Even if it is compressed, it would help narrow down the location.

Just a hunch: have you programmed any custom fields in your application?

On Wed, 30 Oct 2019 at 11:44, Mayo <mayo...@borgiq.com> wrote:
Hi,

I tried upgrading Blockly from 2.20190722.1 to 3.20191014.4 but now when I try to drop a block from the toolbox into the workspace I get an error 'TypeError: text is null` when running `Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace())`

When I replace Blockly back to the older version it works for me, has anyone else run into this issue?

Thanks.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blo...@googlegroups.com.
Screen Shot 2019-10-30 at 3.14.18 PM.png

Amber B

unread,
Oct 30, 2019, 3:21:52 PM10/30/19
to Blockly
Does this happen with any block you try to drop in, or only with specific ones? And when do you run workspaceToCode... as a listener in the workspace change event?

Mayo

unread,
Oct 30, 2019, 3:28:23 PM10/30/19
to Blockly
Yes, it seems to be with any block. 

And yes its inside the workspace.addChangeListener. I commented it out in the change listener and ran the workspaceToCode line in the browser after placing a block into the workspace and I see the same error.

Neil Fraser

unread,
Oct 30, 2019, 3:30:13 PM10/30/19
to blo...@googlegroups.com
Thanks, that's very helpful.

The code on master absolutely cannot do this (there's an explicit check that 'comment' isn't null before calling string.wrap).  However, the line numbers in generator/javascript.js for master don't match up with your error trace (255 vs 156).

Give me a moment while I try to find the version of the code you are using...

To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/e58b8718-16ab-4e37-bf51-90948bbf9a36%40googlegroups.com.

Neil Fraser

unread,
Oct 30, 2019, 3:41:41 PM10/30/19
to blo...@googlegroups.com
On Wed, 30 Oct 2019 at 12:29, Neil Fraser <ro...@neil.fraser.name> wrote:
Give me a moment while I try to find the version of the code you are using...

Nope, I cannot find any version of that code in our repository that has a call to 'Blockly.utils.string.wrap' on line 156 (or anywhere near it) of generator/javascript.js.  Do you mind attaching your copy of generator/javascript.js so we can see what you've got?  Thanks!

I note that your copy of this file is in a directory called borgiq.  So this must be a forked and modified version.

Mayo

unread,
Oct 30, 2019, 3:53:03 PM10/30/19
to Blockly
Ahh, I didn't realize but we're using a custom generator. I think I can take it from here.

Thanks a lot for the help!
Reply all
Reply to author
Forward
0 new messages