Hello there,
I found an issue in Retool Workflows that seems to make a workflow unusable after adding a JavaScript library.
Steps to reproduce
-
Create a new Workflow.
-
In a JavaScript block, add either:
return numbro(10).format();
or:
return _.random(0, 5);
-
Run the block — it works as expected. The pre-loaded libraries (numbro, _, etc.) are available.
-
Add a library under Libraries → JavaScript library. Any library seems to trigger the issue.
-
Run the same JavaScript block again.
At this point, the block throws an error because the pre-loaded libraries are no longer found.
The workflow also cannot be restored to its previous working state. Even if I manually import the pre-loaded libraries, they still don't work.
So, effectively, adding any JavaScript library appears to break access to the pre-loaded libraries in the Workflow.
Has anyone else experienced this? Is there a workaround, or is this a known issue?
Summary
In Retool Workflows, adding any custom JavaScript library under Libraries → JavaScript library breaks access to the pre-loaded libraries (e.g. numbro, lodash _) in JS Code blocks, throwing 'Cannot find module' errors, and the workflow can't be restored to its prior working state even by manually re-importing the libraries.
AI Response
This behavior has been reported by others where pre-loaded modules like numbro and lodash fail with 'Cannot find module' errors, often after library changes, while the same code still runs when executing a block with previous blocks. The consistent, community- and staff-endorsed workaround is to open the affected library entry (or the JavaScript Configuration) and comment out or remove its const x = require('...') statement, since the pre-loaded libraries are injected automatically and the explicit require can conflict. Note that both cases were reported on cloud instances and confirmed as an underlying platform issue under investigation, so if the workaround doesn't fully resolve it, retrying after a short period may help.
Sources
Previously scheduled Workflow fails: Error cannot find module numbro
A solved thread reporting the exact 'Cannot find module numbro' failure where the accepted workaround is to comment out the module's require statement.
Error: Cannot find module 'lodash'
Corroborates the same issue with the pre-loaded lodash module and confirms that removing/commenting the require line for the library resolves the error.
The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a
,
, or
. Or by marking this post as the "Solution"! Let us know if you have any feedback here. 