Code block fails when running entire workflow, but succeeds when run individually

I'm using the javascript URL interface in a workflow code block. It works when I run the code block individually, but when I run the whole workflow I get this error in the logs:

Error: ReferenceError: URL is not defined

I have a workaround, just wanted to report the issue.

Hey @omarkhan!

To clarify the difference in behavior you are seeing when running blocks individually vs the workflow as a whole -- When running the workflow step by step this is running client side, and when running the workflow as a whole this is running server side. This is definitely confusing and we are working to make this easier to debug! Sorry for the pain point here in the meantime.

1 Like

@omarkhan how did you get around this? I am having a similar issue.

I just rewrote my code without using URL.

I suspect this is happening because Retool runs your code in the browser when you run the block individually. APIs like URL are available in the browser, but not in the backend environment where Retool runs your code when you run the workflow as a whole. Just a theory.

Oops I missed your reply earlier @Kabirdas - yes that's what I figured. Thanks for clarifying!

Hey folks! Just want to circle back here to let you know that the Workflows team has pushed a change so that running individual blocks and previewing your Workflows should now all run in the same environment. If you're still seeing discrepancies between the two please let me know!

Thanks for the update!